#include <bits/stdc++.h>
using namespace std;
int f[150], s[150];
int get(int x) {
  if (f[x] == x) return x;
  return get(f[x]);
}
int main() {
  int n, m, i, fx, fy, x, y, ans = 0;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    f[i] = i;
    s[i] = 1;
  }
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    fx = get(x);
    fy = get(y);
    if (fx == fy && s[fx] % 2 == 1) ans++;
    f[fy] = fx;
    s[fx] += s[fy];
  }
  if ((n - ans) % 2 == 1) ans++;
  printf("%d", ans);
}
