#include using namespace std; using ll = long long; using P = pair; using T = tuple; #include using namespace atcoder; // using mint = modint1000000007; #define rep(i, n) for(ll i = 0; i < n; i++) int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); ll n,m; cin >> n >> m; dsu uf(2*n); rep(i,m) { ll a,b; cin >> a >> b; a--; b--; uf.merge(a,b); } vector g = uf.groups(); ll rest = 0; for(auto group:g) if(group.size()%2) rest++; cout << rest/2 << endl; return 0; }