#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, i, j, k, a, b, solved, abandoned, ct, ans, remain;
  cin >> n >> m;
  vector<vector<int>> adj(n + 1);
  for (i = 0; i < m; i++) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  vector<int> color(n + 1, -1);
  solved = 0;
  abandoned = 0;
  for (i = 1; i <= n; i++) {
    if (color[i] == -1) {
      ct = 0;
      queue<int> q;
      q.push(i);
      color[i] = 1;
      bool conflict = false;
      while (!q.empty()) {
        int id = q.front();
        q.pop();
        ct++;
        for (auto p : adj[id]) {
          if (color[p] == -1) {
            color[p] = 3 - color[id];
            q.push(p);
          } else if (color[p] != 3 - color[id]) {
            conflict = true;
          }
        }
      }
      if (conflict) {
        solved += ct - 1;
        abandoned++;
      } else
        solved += ct;
    }
  }
  ans = abandoned + (solved % 2);
  cout << ans << "\n";
  return 0;
}
