#include <bits/stdc++.h>
using namespace std;
struct Q{
	int to;
};

vector <Q> g[10000];

int d[10000],p[10000],n,m,u1,u2;
long long num;
bool done[10000];

void find(int k);
int main()
{
	freopen ("barrack.in","r",stdin);
	freopen ("barrack.out","w",stdout);
	memset(done,true,sizeof(done));
	scanf ("%d%d",&n,&m);
	
	for (int i = 1;i <= m;i++)
		{
			scanf ("%d%d",&u1,&u2);
			g[u1].push_back((Q){u2});
			g[u2].push_back((Q){u1});
		}
	for (int i = 1;i <= n;i++)
		find(i);
	num /= 2;
	num += n * 2;
	printf("%d",num);
}
void find(int k)
{
	for (int i = 0;i < g[k].size();i++)
		{
			done[k] = false;
			if (done[g[k][i].to])
				{
					find(g[k][i].to);
					num++;
				}
			done[k] = true;
		}
}