There are 40 students participating in the mathematics competition. Xiaohong and the classmates who participated in the competition each shook hands once, how many times in total?
参加数学比赛的同学有40人．小红和一起参加比赛的同学每人握一次手，一共握多少次？
<gadget id="calculator">40 - 1</gadget>
<output>39</output>

<result>39</result>