Adam has 18 magnets. He gave away a third of the magnets, and he still had half as many magnets as Peter. How many magnets does Peter have?
Please reason step by step, and put your final answer within \boxed{}.
user