Alex stocks up for winter. He buys 32 cans of vegetables. He pays 80 cent per can for tomatoes and 40 cents per can for corn, for a total cost of $18. How many cans of tomatoes does he buy?