#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int> > en;
  vector<vector<int> > v(n + 1);
  while (m--) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
    en.push_back(make_pair(a, b));
  }
  int count = 0;
  vector<int> level(n + 1, 0);
  int l = 1;
  for (int i = 1; i <= n; i++) {
    queue<int> q;
    if (level[i] == 0 && v[i].size() > 0) {
      q.push(i);
      level[i] = l;
      l++;
      q.push(0);
      while (!q.empty()) {
        int a = q.front();
        q.pop();
        if (a == 0) {
          l++;
          if (q.empty())
            break;
          else
            q.push(0);
          continue;
        }
        for (int j = 0; j < v[a].size(); j++) {
          int b = v[a][j];
          if (level[b] == 0) {
            level[b] = l;
            q.push(b);
          }
        }
      }
      l++;
    }
  }
  for (int i = 0; i < en.size(); i++) {
    if (level[en[i].first] == level[en[i].second] && level[en[i].first] != 0)
      count++;
  }
  if ((n - count) % 2 != 0) count++;
  cout << count << endl;
}
