Niels Bohr was super smart. Check out his model here.
Ions attract and form compounds in specific ratios. Struggle with writing these formulas here are some great examples.