#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> graph;
vector<int> visited;
enum status { PATH = 0, CYCLE = 1 };
status dfs(int cur_node, int par_node, int &count) {
  if (visited[cur_node]) return CYCLE;
  visited[cur_node] = 1;
  for (auto child_node : graph[cur_node]) {
    if (child_node != par_node) {
      count++;
      if (dfs(child_node, cur_node, count) == CYCLE) return CYCLE;
    }
  }
  return PATH;
}
int main() {
  int n, m;
  cin >> n >> m;
  graph = vector<vector<int>>(n);
  visited = vector<int>(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (!visited[i]) {
      int count = 0;
      status solve = dfs(i, -1, count);
      if (solve == CYCLE) ans += (count % 2 == 1);
    }
  }
  if ((n - ans) % 2 == 1) ans++;
  cout << ans;
  return 0;
}
