Tom has a collection of 40 baseball cards. He decides to give away some of his cards to his friends. After giving away 12 cards, how many baseball cards does Tom have left?