#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> ADJLST;
bool dfs(vector<int> &Visited, int &count, int vertex, int par) {
  Visited[vertex] = 2;
  for (int i = 0; i < ADJLST[vertex].size(); i++) {
    int adj = ADJLST[vertex][i];
    if (Visited[adj] == 2 && adj != par) {
      return true;
    } else if (Visited[adj] == 0) {
      count++;
      if (dfs(Visited, count, adj, vertex)) {
        return true;
      }
    }
  }
  return false;
}
int main() {
  int n, m;
  cin >> n >> m;
  ADJLST.resize(n + 1);
  while (m--) {
    int A, B;
    cin >> A >> B;
    ADJLST[A].push_back(B);
    ADJLST[B].push_back(A);
  }
  vector<int> Visited(n + 1, 0);
  int Rem = 0;
  int members = 0;
  for (int i = 1; i <= n; i++) {
    int vertices = 1;
    if (Visited[i] == 0) {
      if (dfs(Visited, vertices, i, 0) && (vertices & 1)) {
        Rem++;
        vertices--;
      }
      members += vertices;
    }
  }
  if (members & 1) Rem++;
  cout << Rem;
}
