Anna ranked 12th from the top and 31st from the bottom among those who passed an examination. If 8 students did not participate in the exam and 7 students failed it, how many total students are there in the grade?
(The students who failed the exam do not appear on the rank list.)