#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<vector<int> > g(n + 1);
  vector<bool> visited(n + 1, false);
  int a, b;
  while (m-- > 0) {
    scanf("%d %d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int lineas = 0;
  int ciclos = 0;
  bool ciclo;
  int len, v, last, u;
  for (int i = 1; i <= n; i++) {
    if (visited[i]) continue;
    stack<int> s;
    stack<int> p;
    len = 0;
    s.push(i);
    p.push(-1);
    while (!s.empty()) {
      v = s.top();
      s.pop();
      u = p.top();
      p.pop();
      if (visited[v]) continue;
      visited[v] = true;
      len++;
      int chi = g[v].size();
      for (int j = 0; j < chi; j++) {
        if (visited[g[v][j]] && g[v][j] != u) {
          ciclo = true;
        }
        p.push(v);
        s.push(g[v][j]);
      }
    }
    if (len % 2 == 1) {
      if (ciclo)
        ciclos++;
      else
        lineas++;
    }
    ciclo = false;
  }
  printf("%d\n", ciclos + (lineas % 2));
  return 0;
}
