There are 24 students in a class. 1/2 are boys. 1/3 of the boys are wearing hats. How many boys are wearing hats?