#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adjList(102);
int x, y, n, m, res, cnt;
bool visted[102];
bool dfs(int Node, int Parent) {
  if (visted[Node]) {
    return 1;
  }
  visted[Node] = 1;
  for (auto child : adjList[Node]) {
    if (child != Parent) {
      cnt++;
      if (dfs(child, Node)) return 1;
    }
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    adjList[x].push_back(y);
    adjList[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (!visted[i]) {
      cnt = 0;
      res += ((dfs(i, -1)) && (cnt % 2));
    }
  }
  res += (n % 2 != res % 2);
  cout << res << endl;
  return 0;
}
