Number mismatch in gro and topology file

I need to add Zn2+ and Mg2+ ions to my system of protein. However, running the gmx grompp command its showing me the following error:
Fatal error:
number of coordinates in coordinate file (solv.gro, 178616)
does not match topology (, 178620)

I calculated the number of atoms in both the files and its 178616 in both. Why is this error showing and how do I fix it ?

My guess is that when you have added the ions to the system the topology file was not properly updated. You can check that the last directive [molecules] of topology file contains a number of protein molecules, solvent molecules and ions identical of the gro file (for each type of molecules).