#include <bits/stdc++.h>
using namespace std;
void print(vector<long long> v) {
  for (auto i : v) cout << i << " ";
  cout << '\n';
}
void dfs(long long i, vector<vector<long long>> adj, vector<bool> &v, bool c,
         vector<bool> &col, long long &ans) {
  v[i] = 1;
  col[i] = c;
  for (long long j = 0; j < adj[i].size(); j++) {
    if (!v[j] && adj[i][j])
      dfs(j, adj, v, !c, col, ans);
    else if (v[j] && (col[j] == col[i]) && adj[i][j]) {
      ans++;
    }
  }
}
void call() {
  long long n, m, a, b;
  cin >> n >> m;
  vector<vector<long long>> adj;
  vector<long long> temp(n, 0);
  for (long long i = 0; i < n; i++) adj.push_back(temp);
  for (long long i = 0; i < m; i++) {
    cin >> a >> b;
    a = a - 1;
    b -= 1;
    adj[a][b] = 1;
    adj[b][a] = 1;
  }
  vector<bool> v(n, 0), col(n, 0);
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (!v[i]) dfs(i, adj, v, 0, col, ans);
  }
  ans = ans / 2;
  if ((n - ans) % 2 == 0)
    cout << ans << '\n';
  else
    cout << ans + 1 << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  t = 1;
  while (t--) {
    call();
  }
  return 0;
}
