There are 40 students in a certain class, and this class organizes three math competitions. When the teacher adds up the number of students participating in the three competitions, he gets a total of 75 students. It is known that there are 7 students who have participated in all three competitions, and each student has participated in at least one competition. How many students exactly participated in the second competition?
某个班级有40名学生，这个班组织了三次数学竞赛．当老师将参加这三次竞赛的学生人数加起来时，他得到的总人数为75人．已知三次竞赛全部参加的学生有7人，且每位学生至少都参加了一次竞赛，求恰好只参加了二次竞赛的学生有多少人？
<gadget id="calculator">40 + 7 + 7</gadget>
<output>54</output>

<gadget id="calculator">75 - 54</gadget>
<output>21</output>

<result>21</result>