#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int pset[N];
bool cycle[N];
int n, m;
void init() { memset(pset, -1, sizeof pset); }
int finds(int x) { return pset[x] < 0 ? x : pset[x] = finds(pset[x]); }
void join(int x, int y) {
  x = finds(x);
  y = finds(y);
  if (x == y) {
    cycle[x] = 1;
  } else {
    pset[x] += pset[y];
    pset[y] = x;
  }
}
void readAndJoin() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    join(u, v);
  }
}
int work() {
  int a = 0;
  int b = 0;
  int oddCycle = 0;
  for (int i = 1; i <= n; i++) {
    if (finds(i) == i) {
      if (cycle[i]) {
        if (-pset[i] % 2 == 0) {
          int part = (-pset[i]) / 2;
          a += part;
          b += part;
        } else {
          oddCycle++;
          int part = (-pset[i] - 1) / 2;
          a += part;
          b += part;
        }
      } else {
        int part1 = (-pset[i]) / 2;
        int part2 = -pset[i] - part1;
        if (a <= b) {
          a += part2;
          b += part1;
        } else {
          a += part1;
          b += part2;
        }
      }
    }
  }
  int ans = oddCycle;
  if (a != b) {
    ans++;
  }
  return ans;
}
int main() {
  init();
  readAndJoin();
  printf("%d\n", work());
  return 0;
}
