#include using namespace std; #define ll long long #define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++) #define rrep(i, n, a) for (int i = (int)(n); i >= (int)(a); i--) void solve(){ int n,m; cin >> n >> m; vector> adj(2*n); rep(i,0,m){ int x,y; cin >> x >> y; x--;y--; adj[x].push_back(y); adj[y].push_back(x); } vector color(2*n); iota(color.begin(), color.end(), 1); vector seen(n*2, false); stack todo; rep(i,0,2*n) todo.push(i); while(!todo.empty()){ int x = todo.top(); todo.pop(); if(seen[x]) continue; seen[x] = true; for(int u: adj[x]){ color[u] = color[x]; todo.push(u); } } int ans = 0; sort(color.begin(), color.end()); int s = 1; rep(i,1,2*n){ if(color[i] != color[i-1]){ s = 1; ans += s % 2; } else s++; } ans += s % 2; cout << ans/2; } int main(){ ios::sync_with_stdio(false); cin.tie(0); solve(); return 0; }