/*
#include <stdio.h>
#include <stdlib.h>
int queue[2][100000];
int end[2];
int start[2];
void push1(int n)
{
queue[0][end[0]] = n;
end[0]++;
}
void push2(int n)
{
queue[1][end[1]] = n;
end[1]++;
}
void pop1()
{
start[0]++;
}
void pop2()
{
start[1]++;
}
int main()
{
char c[101][101];
int visted[101][101] = {{0,}};
int i,j,k,l,count=0;
int m,n,z;
scanf("%d%d",&n,&m);
for(i = 0; i < m; i++)
{
for(j = 0; j < n; j++)
{
scanf(" %c",&c[i][j]);
}
}
for(i = 0; i < m; i++)
{
for(j =0; j < n; j++)
{
if(c[i][j] == 'L'&&visted[i][j] == 0)
{
push1(i);
push2(j);
z++;
count++;
while(z != 0)
{
for(l=z,z=0; l>0; l--)
{
int x = queue[1][start[1]];
int y = queue[0][start[0]];
if(x-1!=-1&&!visted[y][x-1]&&c[y][x-1]=='L')
{
push1(y);
push2(x-1);
visted[y][x-1]=1;
z++;
}
if(y-1!=-1&&!visted[y-1][x]&&c[y-1][x]=='L')
{
push1(y-1);
push2(x);
visted[y-1][x]=1;
z++;
}
if(x+1!=n&&!visted[y][x+1]&&c[y][x+1]=='L')
{
push1(y);
push2(x+1);
visted[y][x+1]=1;
z++;
}
if(y+1!=m&&!visted[y+1][x]&&c[y+1][x]=='L')
{
push1(y+1);
push2(x);
visted[y+1][x]=1;
z++;
}
if(x+1!=n&&y+1!=m&&!visted[y+1][x+1]&&c[y+1][x+1]=='L')
{
push1(y+1);
push2(x+1);
visted[y+1][x+1]=1;
z++;
}
if(x-1!=-1&&y-1!=-1&&!visted[y-1][x-1]&&c[y-1][x-1]=='L')
{
push1(y-1);
push2(x-1);
visted[y-1][x-1]=1;
z++;
}
if(x-1!=-1&&y+1!=m&&!visted[y+1][x-1]&&c[y+1][x-1]=='L')
{
push1(y+1);
push2(x-1);
visted[y+1][x-1]=1;
z++;
}
if(x+1!=n&&y-1!=-1&&!visted[y-1][x+1]&&c[y-1][x+1]=='L')
{
push1(y+1);
push2(x-1);
visted[y+1][x-1]=1;
z++;
}
pop1();
pop2();
}
}
}
}
}
printf("%d",count);
}
*/
#include <stdio.h>
int main()
{
int arr[100][100]= {{0,},};
int arrsize[100]= {0,};
int atact[100]= {0,};
atact[1] = 1;
int i,n,m,j,o;
int k,l,count=0;
scanf("%d%d",&n,&m);
for(i = 0; i < m; i++)
{
scanf("%d %d",&k,&l);
arr[k][arrsize[k]] = l;
arrsize[k]++;
arr[l][arrsize[l]] = k;
arrsize[l]++;
}
for(i = 1; i <= n; i++)
{
if(!atact[i])
for(j = 0; j < arrsize[i]; j++)
{
if(atact[arr[i][j]] == 1)
{
atact[i] = 1;
break;
}
}
if(atact[i])
{
for(j = 0; j < arrsize[i]; j++)
{
if(atact[arr[i][j]] == 0)
{
atact[arr[i][j]] = 1;
if(arr[i][j] < i)
{
int x = arr[i][j];
for(o = 0;o < arrsize[x];o++)
{
atact[arr[x][o]] = 1;
}
}
}
}
}
}
for(i = 2; i <= n; i++)
{
count += atact[i];
}
printf("%d",count);
}