There are 9 students in class 3 and 3 who go to the nursing home to do good deeds every month, and 7 students insist on writing a letter to the "hand in hand" friends every month, and 4 of them participate in both activities. How many students participated in these two activities?
三3班有9名同学每月都去敬老院做好事，有7名同学坚持每月给"手拉手"小伙伴写一封信，其中有4名同学两个活动都参加．参加这两个活动的一共有多少名同学？
<gadget id="calculator">7 - 4</gadget>
<output>3</output>

<gadget id="calculator">9 + 3</gadget>
<output>12</output>

<result>12</result>