# 【 CodeForces 209C】 【欧拉回路推结论+并查集计算联通分量】 【给定n点m边无向图，可能有自环和重边。 问最少添加多少条边后，使得图存在从点1出发发又回到点1的欧拉回路】

time limit per test
4 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Vasya went for a walk in the park. The park has n glades, numbered from 1 to n. There are m trails between the glades. The trails are numbered from 1 to m, where the i-th trail connects glades xi and yi. The numbers of the connected glades may be the same (xi = yi), which means that a trail connects a glade to itself. Also, two glades may have several non-intersecting trails between them.

Vasya is on glade 1, he wants to walk on all trails of the park exactly once, so that he can eventually return to glade 1. Unfortunately, Vasya does not know whether this walk is possible or not. Help Vasya, determine whether the walk is possible or not. If such walk is impossible, find the minimum number of trails the authorities need to add to the park in order to make the described walk possible.

Vasya can shift from one trail to another one only on glades. He can move on the trails in both directions. If Vasya started going on the trail that connects glades a and b, from glade a, then he must finish this trail on glade b.

Input

The first line contains two integers n and m (1 ≤ n ≤ 106; 0 ≤ m ≤ 106) — the number of glades in the park and the number of trails in the park, respectively. Next m lines specify the trails. The i-th line specifies the i-th trail as two space-separated numbers, xiyi(1 ≤ xi, yi ≤ n) — the numbers of the glades connected by this trail.

Output

Print the single integer — the answer to the problem. If Vasya's walk is possible without adding extra trails, print 0, otherwise print the minimum number of trails the authorities need to add to the park in order to make Vasya's walk possible.

Examples
input
3 3
1 2
2 3
3 1

output
0

input
2 5
1 1
1 2
1 2
2 2
1 2

output
1

Note

In the first test case the described walk is possible without building extra trails. For example, let's first go on the first trail, then on the second one, and finally on the third one.

In the second test case the described walk is impossible without adding extra trails. To make the walk possible, it is enough to add one trail, for example, between glades number one and two.

• 如果全图连通，则答案是奇数度数点的个数/2.

• 否则答案是奇数度数点的个数/2+不含奇数度数点的连通块的个数。

#include <bits/stdc++.h>
#define pr(x) cout << #x << "= " << x << "  " ；
#define pl(x) cout << #x << "= " << x << endl;
#define ll __int64
using  namespace  std;

char CH; bool F=false;
for(CH=getchar();CH<'0'||CH>'9';F= CH=='-',CH=getchar());
for(num=0;CH>='0'&&CH<='9';num=num*10+CH-'0',CH=getchar());
F && (num=-num);
}
int stk[70], tp;
template<class T> inline void print(T p) {
if(!p) { puts("0"); return; }
while(p) stk[++ tp] = p%10, p/=10;
while(tp) putchar(stk[tp--] + '0');
putchar('\n');
}

const int N=1e6+10;

int p[N],deg[N];
int flag[N];//是否含有奇数点的联通分量
int vis[N];
int n,m;

int Find(int x){
return p[x]==x?x:p[x]=Find(p[x]);
}

void unite(int x,int y){
x=Find(x);
y=Find(y);
if(x!=y)
p[y]=x;
}

int  main(){
/* #ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif*/

for(int i=1; i<=n; i++)p[i]=i;
vis[1]=1;
for(int i=1; i<=m; i++){
int u,v;
if(u!=v){
deg[u]++; deg[v]++;
vis[u]++; vis[v]++;
unite(u, v);
}
else vis[u]++;
}
for(int i=1; i<=n; i++){
if(deg[i]&1){
flag[Find(i)]++;
}
}
int tong=0,ans=0,k=0;
for(int i=1; i<=n; i++){
if(vis[i] && Find(i)==i){
if(flag[i])ans+=flag[i];
else tong++;
k++;//计算几个联通分量
}
}
if(k==1)print(ans/2);//全图连通
else print(ans/2+tong);
return 0;
}