#include <bits/stdc++.h>
using namespace std;
vector<int> en[105];
bool vis[105];
int res;
bool vs;
void dfs(int p, int ind, int len) {
  if (vs) return;
  if (vis[ind]) {
    vs = true;
    if (len % 2) res++;
    return;
  }
  vis[ind] = 1;
  for (int i = 0; i < (int)en[ind].size(); i++) {
    if (en[ind][i] == p) continue;
    dfs(ind, en[ind][i], len + 1);
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  int a, b;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    a--;
    b--;
    en[a].push_back(b);
    en[b].push_back(a);
  }
  for (int i = 0; i < n; i++) {
    if (vis[i]) continue;
    vs = false;
    dfs(-1, i, 0);
  }
  if ((n - res) % 2) res++;
  cout << res << endl;
}
