#include <bits/stdc++.h>
using namespace std;
vector<int> adj[101];
int vis[101];
int col[101];
bool dfs(int src, int c) {
  vis[src] = 1;
  col[src] = c;
  for (int nbr : adj[src]) {
    if (vis[nbr] == 0) {
      if (!dfs(nbr, c ^ 1)) return false;
    } else {
      if (col[src] == col[nbr]) return false;
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, a, b;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    adj[a].push_back(b), adj[b].push_back(a);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      bool rec = dfs(i, 0);
      if (!rec) ans += 1;
    }
  }
  if ((n - ans) % 2) ans++;
  cout << ans << "\n";
  return 0;
}
