You have decided to throw a party! Since a one-person party is quite no-life, you have decided to invite all your friends along! In addition, they have also invited their friends along as well. However, to prevent your house from overflowing with people, you have decided to draw the line there, friends-of-friends are the farthest you will go. Now, you want to find out exactly how many people are going down for your party (excluding yourself).
Given the number of people N as well as details of M friendships, output the number of people excluding yourself going down for your party. Note: Friendship is mutual! We aren't stalkers here :)
The first line of input will contain N, the number of people (2 ≤ N ≤ 500). You are person 1.
The second line of input will contain M, the number of friendships (1 ≤ M ≤ 10,000).
The next M lines of input will contain two integers a and b, indicating that a and b are friends (1 ≤ a,b ≤ N). Remember, no stalking!
Output one integer, the number of people going down for your party excluding yourself
6 5 1 2 1 3 3 4 2 3 5 4
3
6 5 2 3 4 3 5 4 5 6 2 5
0
Subtask | Score |
---|---|
1 | 100 |
2 | 0 |