By Kay Akashi
On the social media platform Imstagran, you are assigned an index . You are going to be a friend with a certain number of people amongst people each of which is assigned an index ranging from to but not ( People including you are assigned distinct indices from to ).
In lines you are given and indicating that and are friends on Imstagran. Now, you are asked to count the number of people who are either "your friends" or "friends of your friends". Clearly, you yourself are "a friend of your friend" hence counted, only if you have any friend. If you are "lonely enough" ( you don't have a single friend), you are NOT "a friend of your friend" hence not counted, sadly.
Note that, unlike Imstagran's rival social media Instagram, it never happens that one follows another but not followed back. On Imstagran, two people are friends and they bilaterally follow each other.
, .
The first line of input contains three integers, , , and . Following are lines each of which consists of , .
Output the answer.
4 2 3
1 4
2 4
2 3
4
You can see that and are your friends. You, whose index is , are a friend of and . Also, is a friend of your friend , hence a friend of your friend. All people here meet the condition, thus the answer is .
5 1 2
3 4
4 5
0
You have no friend. Because you have no friend, there're no friends of your friend. The answer is .