#include using namespace std; struct UnionFind{ vector par; vector edg; UnionFind(int N) : par(N), edg(N){ for(int i = 0; i < N; ++i){ par[i] = -1; edg[i] = 0; } } int root(int x){ if(par[x] < 0) return x; return par[x] = root(par[x]); } void unite(int x, int y){ int rx = root(x); int ry = root(y); if(rx == ry){ edg[rx]++; return; } par[ry] = par[rx] + par[ry]; par[rx] = ry; edg[ry] += edg[rx] + 1; } bool same(int x, int y){ int rx = root(x); int ry = root(y); return rx == ry; } long long size(int x){ return -par[root(x)]; } long long edge(int x){ return edg[root(x)]; } }; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; assert(1 <= n <= 100000); assert(0 <= m <= 100000); UnionFind uf(2 * n); for(int i = 0; i < m; i++){ int a, b; cin >> a >> b; assert(1 <= a <= 2 * n); assert(1 <= b <= 2 * n); a--, b--; uf.unite(a, b); } int ans = 0; for(int i = 0; i < 2 * n; i++){ if(uf.root(i) == i && uf.size(i) % 2) ans++; } cout << ans / 2 << endl; }