#include using namespace std; using llong = long long; using ldbl = long double; using lpair = pair; #define ALL(x) x.begin(), x.end() constexpr llong mod = 1e9+7; constexpr llong inf = mod * mod; struct union_find { std::vector par; union_find() {} union_find(int n) : par(n+1, -1) {} int root(int x) { if(par[x] < 0) return x; return par[x] = root(par[x]); } int size(int x) { return -par[root(x)]; } bool same(int a, int b) { return root(a) == root(b); } bool merge(int a, int b) { a = root(a), b = root(b); if(a == b) return false; if(par[a] > par[b]) std::swap(a, b); par[a] += par[b]; par[b] = a; return true; } }; int main() { llong N, M; cin >> N >> M; union_find uf(2 * N); for (int i = 0; i < M; i++) { llong A, B; cin >> A >> B; uf.merge(A, B); } set used; llong cnt = 0; for (int i = 1; i <= 2 * N; i++) { if (used.count(uf.root(i))) { continue; } used.insert(uf.root(i)); cnt += uf.size(i) % 2; } cout << cnt / 2 << endl; return 0; }