import sys
V = int(input())
E = int(input())
graph = [[] for _ in range(V+1)]
for _ in range(E):
a,b = map(int, sys.stdin.readline().split())
graph[a] += [b]
graph[b] += [a]
visited = [0] * 101
def DFS(v):
visited[v] = 1
for i in graph[v]:
if visited[i] == 0:
visited[i] = 1
DFS(i)
DFS(1)
print(sum(visited)-1)
from collections import deque
import sys
V = int(input())
E = int(input())
graph = [[] for _ in range(V+1)]
for _ in range(E):
a,b = map(int, sys.stdin.readline().split())
graph[a] += [b]
graph[b] += [a]
visited = [0] * 101
def BFS(v):
queue = deque()
queue.append(v)
visited[v] = 1
while queue:
a = queue.popleft()
for i in graph[a]:
if visited[i] == 0:
queue.append(i)
visited[i] = 1
BFS(1)
print(sum(visited)-1)
DFS/BFS 함수를 이용하여 1번 컴퓨터와 연결되어 있는 컴퓨터의 수를 탐색하여 값을 출력한다.