As you know, an element's atomic number tells you how many protons an atom of said element has inside its nucleus.
Now, a neutral atom will always have equal numbers of protons inside its nucleus and electrons surrounding its nucleus. You can thus say that for a neutral atom, the atomic number also gives you the total number of electrons that surround that atom's nucleus.
When the number of electrons and the number of protons don't match, the atom develops an overall net charge and becomes an ion.
You have two possibilities here
when an atom has more protons inside its nucleus than electrons surrounding its nucleus, i.e. when it loses electrons, it will carry an overall positive charge
#->#it will be a cation
when an atom has more electrons surrounding its nucleus than protons inside its nucleus, i.e. when it gains electrons, it will carry an overall negative charge
#->#it will be an anion
The magnitude of the charge will depend on the actual difference between the number of protons and the number of electrons.
Atoms that gain
Likewise, atoms that lose
Therefore, the relationship between the atomic number and the number of electrons tells you if you're dealing with a neutral atom or with an ion.