Reconsider your energy level diagram for magnesium. Imagine adding electrons until you reach the next element with a configuration that has the same number of valence electrons as magnesium.
a) How many total electrons would this element possess?
b) What neutral element would this be?
c) How is that element located relative to magnesium in the periodic table?