1 #include <bits/stdc++.h> 2 #define _for(i,a,b) for(int i = (a);i < (b);i ++) 3 using namespace std; 4 5 const int MAXV = 100003; 6 int V,E,Vis[MAXV]; 7 vector<int> G[MAXV]; 8 9 int dfs(int u) 10 { 11 if(Vis[u]) return 0; 12 Vis[u] = 1; 13 int sz = G[u].size(),r = sz&0x1; 14 _for(i,0,sz) r += dfs(G[u][i]); 15 return r; 16 } 17 18 int main() 19 { 20 for(int a,b,n;cin >> V >> E;n = 0) 21 { 22 _for(i,0,V+1) G[i].clear(); 23 memset(Vis,0,sizeof(Vis)); 24 _for(i,0,E) 25 { 26 cin >> a >> b; 27 if(a==b) continue; 28 G[a-1].push_back(b-1),G[b-1].push_back(a-1); 29 } 30 31 _for(i,0,V) 32 { 33 if(Vis[i] || G[i].empty()) continue; 34 n ++,n += max(0,dfs(i)/2-1); 35 } 36 cout << n << endl; 37 } 38 return 0; 39 }