On her way home from school Gloria Sol met a friend and gave her one half of all her candy. Next, she met another friend and gave her one third of all the candy she had left. Then, she met another friend and gave him one half of all the candy she had left. She then had 12 pieces left. How many pieces did she start with?