On finite groups with a given number of centralizers