/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
ifstream fin("dfs.in");
ofstream fout("dfs.out");
int viz[100001];
vector<vector<int>> g(100001);
void dfs(int i)
{
int j;
viz[i]=1;
for(j=0;j<g[i].size();j++)
{
if(viz[g[i][j]]!=1)
{
dfs(g[i][j]);
}
}
}
int main()
{
int x,y,i,j,n,m,rez=0;
fin>>n>>m;
for(i=1;i<=m;i++)
{
fin>>x>>y;
g[x].push_back(y);
g[y].push_back(x);
}
for(i=1;i<=n;i++)
{
cout<<g[i].size();
}
for(i=1;i<=n;i++)
{
if(viz[i]==0)
{
rez++;
dfs(i);
}
}
fout<<rez;
return 0;
}