#include <bits/stdc++.h>
using namespace std;
vector<vector<bool> > gragh;
vector<bool> vis;
int n, m;
bool dfs(int node, int par, int& cnt) {
  if (vis[node]) {
    return true;
  }
  vis[node] = true;
  for (int i = 0; i < n; i++) {
    if (i != par) {
      if (gragh[node][i]) {
        cnt++;
        if (dfs(i, node, cnt)) {
          return true;
        }
      }
    }
  }
  return false;
}
int main(int argc, char** argv) {
  cin >> n >> m;
  gragh.resize(n, vector<bool>(n, false));
  vis.resize(n, false);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    gragh[a - 1][b - 1] = 1;
    gragh[b - 1][a - 1] = 1;
  }
  int del = 0;
  for (int i = 0; i < n; i++) {
    if (!vis[i]) {
      int cnt = 0;
      if (dfs(i, -1, cnt)) {
        if (cnt % 2) del++;
      }
    }
  }
  if ((n - del) % 2) del++;
  cout << del;
  return 0;
}
