P27199 [AtCoder] Party
提高-
题目描述

Problem Description

You have decided to invite your friends at school and your friends' friends to a Christmas party. The number of students at your school is $n$, and each student is assigned a number from $1$ to $n$. Your number is $1$. You have a list that shows who is friends with whom. Based on this list, create a program to determine the number of students you will invite to the Christmas party.


Input Format

The first line of input contains the number of students at the school, $n$ ($2 \leq n \leq 500$). The second line contains the length of the list, $m$ ($1 \leq m \leq 10,000$). The input consists of $2 + m$ lines in total. The $(2 + i)$-th line ($1 \leq i \leq m$) contains two integers $a_i$ and $b_i$ ($1 \leq a_i < b_i \leq n$), separated by a space, indicating that the student with number $a_i$ is friends with the student with number $b_i$. From the third line to the $(2 + m)$-th line, there are no duplicate lines representing the same friendship.

Output Format

The output consists of one line containing the number of students you will invite to the Christmas party.


Sample Input and Output

Sample Input #1

6
5
1 2
1 3
3 4
2 3
4 5

Sample Output #1

3

Sample Input #2

6
5
2 3
3 4
4 5
5 6
2 5

Sample Output #2

0

Notes/Hints

Sample Explanation 1

In Sample Input #1, your friends are the students with numbers $2$ and $3$. Since the students with numbers $3$ and $4$ are friends, the student with number $4$ is your friend's friend. The students with numbers $5$ and $6$ are neither your friends nor your friends' friends. Therefore, you will invite the $3$ students with numbers $2, 3, 4$ to the Christmas party.


Sample Explanation 2

In Sample Input #2, you have no friends. Therefore, the number of students you will invite to the Christmas party is $0$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6 5 1 2 1 3 3 4 2 3 4 5
样例输出
3