#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using std::bitset;
using namespace std;
struct node {
  int ver, next;
} edge[21000];
int adj[21000], tot;
int vis[21000];
int ans, cnt, n, m;
void addedge(int u, int v) {
  edge[tot].ver = v;
  edge[tot].next = adj[u];
  adj[u] = tot++;
  edge[tot].ver = u;
  edge[tot].next = adj[v];
  adj[v] = tot++;
}
int dfs(int s, int pre) {
  int i, j, tem, y, ans = 0;
  vis[s] = -1;
  cnt++;
  for (j = adj[s]; j != -1; j = edge[j].next) {
    y = edge[j].ver;
    if (vis[y] == -1 && y != pre) {
      ans = cnt % 2;
      break;
    }
    if (vis[y] == 0) {
      ans = dfs(y, s);
      break;
    }
  }
  vis[s] = 1;
  return ans;
}
int main() {
  int i, j, tem;
  int a, b;
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(adj, -1, sizeof(adj));
    ;
    tot = 0;
    for (i = 1; i <= m; i++) {
      scanf("%d%d", &a, &b);
      addedge(a, b);
    }
    ans = 0;
    memset(vis, 0, sizeof(vis));
    ;
    for (i = 1; i <= n; i++)
      if (!vis[i]) {
        cnt = 0;
        ans += dfs(i, 0);
      }
    if ((n - ans) % 2 == 1) ans++;
    printf("%d\n", ans);
  }
  return 0;
}
