#include <bits/stdc++.h>
using namespace std;
const int inf = 1e5 + 5;
vector<int> g[inf];
int vis[inf];
int n, m, cnt;
bool cycle;
void dfs(int u, int last) {
  cnt++;
  if (vis[u]) {
    cycle = true;
    return;
  }
  vis[u] = 1;
  for (auto v : g[u]) {
    if (v != last) dfs(v, u);
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    cycle = false;
    cnt = 0;
    if (!vis[i]) dfs(i, -1);
    ans += (cycle && (cnt % 2));
  }
  cout << ans + (n - ans) % 2 << endl;
}
