A science dass has a total of 40 students. The number of females is 16 less than the number of males. How many males and how many females are in the class?