#include <bits/stdc++.h>
using namespace std;
const int INFint = 2147483647;
const long long INF = 9223372036854775807ll;
const long long MOD = 1000000007ll;
const long double EPS = 1e-9;
vector<int> p;
vector<int> used;
vector<vector<int> > g;
long long ans = 0;
void dfs(int v) {
  used[v] = 1;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (used[to]) {
      if (p[to] == p[v]) {
        ans++;
      }
    } else {
      p[to] = !p[v];
      dfs(to);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  p.resize(n);
  g.resize(n);
  used.resize(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      p[i] = 0;
      dfs(i);
    }
  }
  ans /= 2;
  if ((n - ans) & 1) ans++;
  cout << ans << endl;
  fprintf(stderr, "\nTIME = %lf\n", 1.0 * clock() / CLOCKS_PER_SEC);
  return 0;
}
