At a school bake sale, a total of 40 cupcakes and muffins were sold. The total number of cupcakes sold was 12 more than the number muffins. How many cupcakes were sold at the bake sale?