#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > edges;
vector<int> visited;
int alada = 0;
int start = 0;
bool dfs(int cur, int baap, int cnt) {
  alada++;
  visited[cur] = 0;
  for (int i = 0; i < edges[cur].size(); i++) {
    int nxt = edges[cur][i];
    if (nxt == baap) continue;
    if (visited[nxt] == -1) {
      bool val = dfs(nxt, cur, cnt + 1);
      if (val == true) cerr << cur << endl;
      if (val) return true;
    } else if (visited[nxt] == 0) {
      if (cur == start) continue;
      if (cnt % 2) return true;
      return false;
    }
  }
  visited[cur] = 1;
  return false;
}
int solve() {
  int tot = 0;
  int ot = 0;
  for (int i = 0; i < visited.size(); i++) {
    alada = 0;
    if (visited[i] == -1) {
      start = i;
      if (dfs(i, i, 1)) {
        tot++;
      } else if (alada % 2) {
        ot++;
      }
    }
  }
  if (ot % 2) tot++;
  return tot;
}
int main() {
  int n, m;
  cin >> n >> m;
  visited = vector<int>(n, -1);
  edges = vector<vector<int> >(n);
  int a, b;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    a--, b--;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  int res = solve();
  cout << res << endl;
  return 0;
}
