#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, x, y, sol;
bool a[1002][5002], v[1005];
int main()
{
ifstream f("exam.in");
ofstream g("exam.out");
f >> n >> m;
for(i = 1; i <= m; i++)
{
f >> x >> y;
a[x][y] = a[y][x] = true;
}
for(i = 1; i <= n; i++)
{
if(!v[i])
{
v[i] = true;
for(j = i + 1; j <= n; j ++)
if(!a[i][j])
v[j] = true;
sol ++;
}
}
g << sol;
return 0;
}