There are 30 people in a class participating in long-distance running and table tennis competitions. Among them, 16 people participated in table tennis competitions, and 23 people participated in long-distance running. How many people participated in both competitions?
某班有30人参加长跑和乒乓比赛．其中参加乒乓比赛的有16人，参加长跑的有23人，两种比赛都参加的有几人？
<gadget id="calculator">23 - 30</gadget>
<output>-7</output>

<gadget id="calculator">16 + (-7)</gadget>
<output>9</output>

<result>9</result>