#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 5;
int n, m, cnt, vis[MAX], bipart[MAX];
vector<int> adjList[MAX];
bool bipar = false;
void DFS(int u, int t = 1) {
  ++cnt;
  vis[u] = 1;
  bipart[u] = t;
  for (int v : adjList[u])
    if (!vis[v])
      DFS(v, 3 - t);
    else if (bipart[u] == bipart[v])
      bipar = true;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    adjList[u].push_back(v);
    adjList[v].push_back(u);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) {
      bipar = false;
      cnt = 0;
      DFS(i);
      if (bipar) ++ans;
    }
  if ((n - ans) & 1) ++ans;
  cout << ans;
  return 0;
}
