#include <bits/stdc++.h>
using namespace std;
int father[150], s[150];
int find(int x) {
  if (father[x] == x) {
    return x;
  } else {
    return find(father[x]);
  }
}
int main() {
  int n, m, fx, fy, x, y, ans = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    father[i] = i;
    s[i] = 1;
  }
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    fx = find(x);
    fy = find(y);
    if (fx == fy && s[fx] % 2 == 1) {
      ans++;
    }
    s[fx] += s[fy];
    father[fy] = fx;
  }
  if ((n - ans) % 2 == 1) {
    ans++;
  }
  cout << ans << endl;
  return 0;
}
