링크 : https://www.acmicpc.net/problem/2606
/*
문제 : 바이러스
링크 : https://www.acmicpc.net/problem/2606
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int arr[101][101];
bool visited[101];
int cnt = 0;
int dfs(int all, int n){
visited[n] = true;
for(int i = 1; i <= all; i++){
if(arr[n][i] == 1 && !visited[i]) dfs(all, i);
}
return cnt++;
}
int main(){
int a, b;
cin >> a;
cin >> b;
for(int i = 0; i < b; i++){
int x, y;
cin >> y >> x;
arr[y][x] = 1;
arr[x][y] = 1;
}
cout << dfs(a, 1);
return 0;
}