#include <bits/stdc++.h>
using namespace std;
int F[104 * 2];
int f(int x) {
  if (F[x] == x) return x;
  return F[x] = f(F[x]);
}
int main() {
  int i, AC = 0;
  for (i = 1; i < 104 * 2; i++) F[i] = i;
  int qN, qM;
  scanf("%d%d", &qN, &qM);
  for (i = 0; i < qM; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    int x = f(a), y = f(b);
    int j = f(a + qN), k = f(b + qN);
    if (x == y)
      AC++;
    else
      F[j] = y, F[k] = x;
  }
  if ((qN - AC) % 2) AC++;
  printf("%d\n", AC);
  return 0;
}
