The charge on a magnesium ion is +2. When it formed an ionic compound with another element, it lost 2... what?