We need to set things up in relation to each other, either in terms of females or of males. I will do both
MALES
let X = the number of males
then females is 12 less so it is x - 12
and the total is 42 so x + x - 12 = 42
or 2x -12 =42
or 2x = 42 + 12 or 2x = 54 so X (which is our number of males is 27 and females is 27 12 or 15
Check 27+15 = 42
Now lets' use females
let x = number of Females
then the number of males is x+12
so 2x +12 = 42
so 2x = 30
x , the number of females = 15 and the number of males is 27 (take the number of females , which we found is 15 and add 12 because the number of males is females plus 15
Any problems, just ask