#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> v;
vector<bool> vis;
bool dfs(int current, int parent, int &len) {
  if (vis[current]) {
    return true;
  }
  vis[current] = true;
  for (auto node : v[current]) {
    if (node != parent) {
      len++;
      bool k = dfs(node, current, len);
      if (k) {
        return true;
      }
    }
  }
  return false;
}
int main() {
  int n, m, a, b;
  cin >> n >> m;
  v = vector<vector<int>>(n);
  vis = vector<bool>(n);
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    v[a - 1].push_back(b - 1);
    v[b - 1].push_back(a - 1);
  }
  int toRemove = 0;
  for (int i = 0; i < n; i++) {
    if (!vis[i]) {
      int len = 0;
      bool isCycle = dfs(i, -1, len);
      if (isCycle) {
        toRemove += (len % 2);
      }
    }
  }
  toRemove += (n - toRemove) % 2;
  cout << toRemove;
}
