Mary was Charles I's daughter, married to William of Orange. CharlesII died without legitimate issue so Mary and her husband were invited back by certain factions. For various reasons William had to 'invade'.
I would personally count William and Mary as one monarch. N.B. They didn't have any heir either so were succeeded by Anne (Good Queen Anne) who was Mary's younger sister. She had loads of pregnancies, but no heir - and so....then it gets a bit complicated. History is all about families, I find it fascinating!