Harold found a puzzle with many pieces. He asked Carmen and Emma to help him solve the puzzle. He gave Carmen half his pieces. Harold then gave Emma two-thirds of the pieces he had left after giving pieces to Carmen. Now, Harold has 12 pieces left over to help in solving the puzzle. How many pieces are in the whole puzzle?