Richard purchases a box of 12 cookies and Meghan purchases a bag of 10 cookies. Richard ate x amount of cookies from his box while Meagan ate half the number of cookies Richard ate. How many cookies did Richard eat if they had the same number of cookies left