It depends on whether the ligand is strong or weak. For example, Cyanide and Ammonia are strong ligands that will force the unpaired electrons to get paired, whereas Fluoride is a weak field ligand and cannot force the unpaired electrons to get paired.
In the first example, Iron is a +2 oxidation state which means the iron has a d6; therefore, it has 6 electrons in the d subshell. Strong ligands like Cyanide ion will force the unpaired electrons to get paired. The number of unpaired electrons is zero.
In the second example, Cobalt is in a +2 oxidation state, which is d7 Strong ligands like ammonia ion will force the unpaired electrons to get paired. The number of unpaired electrons is 1.
In the last example, Cobalt is in the d6 configuration, but fluoride cannot force the paired electrons to get paired. Therefore the number of unpaired electrons is 4. ,