Counting real critical points of the distance to spectral matrix sets