#include<iostream>
#include<stdio.h>
#include<string.h>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<sstream>
#include<iomanip>
#include<stdlib.h>
using namespace std;
vector<int> G[100010];
int used[100010];
int oddNumber;
int DFS(int point)
{
int temp = G[point].size();
if (temp % 2 == 1)
{
oddNumber++;
}
int ans = 1;
used[point] = 1;
for (int i = 0; i < G[point].size(); i++)
{
if (used[G[point][i]] == 0)
{
ans += DFS(G[point][i]);
}
}
return ans;
}
int main()
{
freopen("sent.in", "r", stdin);
freopen("sent.out", "w", stdout);
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < m; i++)
{
int point1, point2;
scanf("%d%d", &point1, &point2);
point1--;
point2--;
G[point1].push_back(point2);
G[point2].push_back(point1);
}
int ans = 0;
for (int i = 0; i < n; i++)
{
if (used[i] == 0)
{
oddNumber = 0;
int pointNumber = DFS(i);
if (pointNumber != 1)
{
ans++;
if (oddNumber >= 2)
{
ans += (oddNumber - 2) / 2;
}
}
}
}
ans--;
printf("%d\n", ans);
return 0;
}