#include <bits/stdc++.h>
using namespace std;
map<int, bool> team1, team2, solo, visited;
vector<vector<int> > enemy;
int n;
int visit(int i, int from, int origin) {
  visited[i] = true;
  int visited_nodes = 1;
  bool cycleformed = false;
  for (int j = 0; j < enemy[i].size(); j++) {
    if (from != origin && enemy[i][j] == origin) cycleformed = true;
    if (!visited[enemy[i][j]]) visited_nodes += visit(enemy[i][j], i, origin);
  }
  if (cycleformed == true) return visited_nodes - 9999;
  return visited_nodes;
}
int main() {
  int i, j, t, a, b, size1 = 0, size2 = 0, size3 = 0;
  vector<int> empty;
  team1.clear();
  team2.clear();
  solo.clear();
  visited.clear();
  cin >> n >> t;
  enemy.clear();
  empty.clear();
  for (i = 0; i < n; i++) enemy.push_back(empty);
  while (t--) {
    cin >> a >> b;
    enemy[a - 1].push_back(b - 1);
    enemy[b - 1].push_back(a - 1);
  }
  int ret;
  for (i = 0; i < n; i++)
    if (!visited[i]) {
      ret = visit(i, i, i);
      if (ret < 0) {
        ret = ret + 9999;
        size1 += ret / 2;
        size2 += ret / 2;
      } else if (ret == 1) {
        size3++;
      } else {
        size1 += ret / 2;
        size2 += ret / 2;
        if (ret % 2 == 1) size3++;
      }
    }
  for (i = 0; i < size3; i++) {
    if (size1 <= size2)
      size1++;
    else
      size2++;
  }
  cout << n - 2 * min(size1, size2) << endl;
  return 0;
}
