On the first day of school, in order to let the 40 students in the class get to know each other, the head teacher asked the 40 students to shake hands with each other as a gift, and at the same time introduce themselves to each other. How many times the class shook hands.
开学第一天，班主任老师为了让全班40位同学互相认识，要求这40位同学互相握手为礼，同时彼此介绍自己，全班同学握手的次数是多少．
<gadget id="calculator">40 - 1</gadget>
<output>39</output>

<gadget id="calculator">40 / 2</gadget>
<output>20</output>

<gadget id="calculator">39 * 20</gadget>
<output>780</output>

<result>780</result>