#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> graph;
vector<int> start;
vector<int> finish;
int benched;
int timer;
void dfs(int node) {
  start[node] = timer++;
  for (int i = 0; i < graph[node].size(); i++) {
    int child = graph[node][i];
    if (start[child] == -1)
      dfs(child);
    else if (finish[child] == -1) {
      if ((start[child] - start[node] + 1) % 2 != 0) benched++;
    }
  }
  finish[node] = timer++;
}
int main() {
  int n, m;
  cin >> n >> m;
  graph.resize(n + 1);
  start.resize(n + 1);
  finish.resize(n + 1);
  for (int i = 1; i <= n; i++) {
    start[i] = -1;
    finish[i] = -1;
  }
  benched = 0;
  int a, b;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (start[i] == -1) {
      timer = -1;
      dfs(i);
    }
  }
  if ((n - benched) % 2 != 0) benched++;
  cout << benched;
}
