If you mean how many electrons an atom contains then this is the same as the atomic number of the atom. For example, the atomic number of oxygen is 8 so it contains 8 protons. Since in a stable atom, the number of protons is equal to the number of electrons, oxygen contains 8 electrons.
If you have an ion and you want to know how many electrons it has lost or gained, you look at the charge. If it is a 2+ ion then it has lost two electrons, if it's a - ion then it has gained an electron. The number of electrons in an ion is the atomic number +/- the charge shown. For example a Mg2+ ion would have 10 electrons as a magnesium atom has 12 electrons and loses two to form the 2+ ion.