A group of students participated in swimming and running competitions. Among them, 42 students participated in swimming, 38 students participated in running, and 18 students participated in both. How many students participated in the competition?
有一批同学参加游泳、跑步比赛，其中参加游泳的同学42人，参加跑步的有38个同学，两项都参加的有18人．共有多少名同学参加了比赛．
<gadget id="calculator">38 - 18</gadget>
<output>20</output>

<gadget id="calculator">42 + 20</gadget>
<output>62</output>

<result>62</result>