The two atoms shown in the equation are CALCIUM and oxygen.
You start off with a neutral calcium atom with a shell of two electrons, a shell of 8 around that, a shell of 8 around that, and a shell containing 2...with no charge.
20 protons + 20 electrons.
You also have an oxygen atom with a shell of 2, and a shell of 6...with no charge.
8 protons + 8 electrons.
Each ionizes to form a calcium ion with 2 electrons removed (from the outer shell), leaving a +2 charge (20 protons, 18 electrons)...
and an oxygen ion with 2 electrons added (to the outer shell), leaving a -2 charge (8 protons, 10 electrons).
Their electrostatic attraction causes them to come together to form an ionic compound of CaO in a crystal lattice.