#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  vector<int> clusters(n);
  for (int i = 0; i < n; ++i) {
    clusters[i] = i;
  }
  vector<pair<int, int> > enemies;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    enemies.push_back(make_pair(a, b));
    int clusterId = clusters[b - 1];
    for (int j = 0; j < n; ++j) {
      if (clusters[j] == clusterId) {
        clusters[j] = clusters[a - 1];
      }
    }
  }
  vector<int> numbersOfEdges(n, 0);
  vector<int> clusterSizes(n, 0);
  for (int i = 0; i < n; ++i) {
    int numberOfEdgesInCluster = 0;
    for (int j = 0; j < m; ++j) {
      if (clusters[enemies[j].first - 1] == i) {
        ++numberOfEdgesInCluster;
      }
    }
    numbersOfEdges[i] = numberOfEdgesInCluster;
    int clusterSize = 0;
    for (int j = 0; j < n; ++j) {
      if (clusters[j] == i) {
        ++clusterSize;
      }
    }
    clusterSizes[i] = clusterSize;
  }
  int numberOfStudentsToSendToBenchForSure = 0;
  int numberOfStudentsToProbablySendToBench = 0;
  for (int i = 0; i < n; ++i) {
    if (clusterSizes[i] % 2 == 1) {
      if (numbersOfEdges[i] == clusterSizes[i]) {
        ++numberOfStudentsToSendToBenchForSure;
      } else {
        ++numberOfStudentsToProbablySendToBench;
      }
    }
  }
  cout << numberOfStudentsToSendToBenchForSure +
              (numberOfStudentsToProbablySendToBench % 2);
  return 0;
}
