#include using namespace std; typedef long long ll; typedef pair PP; //#define MOD 1000000007 #define MOD 998244353 #define INF 2305843009213693951 //#define INF 810114514 #define PI 3.141592653589 #define setdouble setprecision #define REP(i,n) for(ll i=0;i<(n);++i) #define OREP(i,n) for(ll i=1;i<=(n);++i) #define RREP(i,n) for(ll i=(n)-1;i>=0;--i) #define ALL(v) (v).begin(), (v).end() #define GOODBYE do { cout << "-1" << endl; return 0; } while (false) #define MM <<" "<< #define Endl endl #define debug true #define debug2 false class unionfind{ // Copyright (c) 2023 0214sh7 // https://github.com/0214sh7/library/ private: std::vector UF,rank,size_; public: void init(int N){ UF.clear(); rank.clear(); size_.clear(); for(int i=0;i> N >> M; vector A(M),B(M); REP(i,M){ cin >> A[i] >> B[i]; A[i]--;B[i]--; } unionfind UF(2*N); REP(i,M){ UF.unite(A[i],B[i]); } ll Ans = 0; REP(i,2*N){ if(i!=UF.root(i))continue; if(UF.size(i)%2==1)Ans++; } Ans /= 2; cout << Ans << endl; return 0; }