#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int n, m, v[N], ans, root, to, forbit, de[N], vi[N];
int tot, first[N], nxt[N * 2], point[N * 2];
inline void add_edge(int x, int y) {
  tot++;
  nxt[tot] = first[x];
  first[x] = tot;
  point[tot] = y;
}
void dfs_find(int x, int father) {
  if (root) return;
  vi[x] = 1;
  for (int i = first[x]; i != -1; i = nxt[i]) {
    int u = point[i];
    if (u == father) continue;
    if (vi[u]) {
      root = x;
      to = u;
      forbit = i;
      return;
    }
    dfs_find(u, x);
  }
}
void dfs(int x, int fa) {
  if (de[x] & 1)
    v[x]--;
  else
    v[x]++;
  for (int i = first[x]; i != -1; i = nxt[i]) {
    int u = point[i];
    if (u == fa) continue;
    de[u] = de[x] + 1;
    dfs(u, x);
    v[x] += v[u];
  }
}
int main() {
  tot = -1;
  memset(first, -1, sizeof(first));
  memset(nxt, -1, sizeof(nxt));
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    add_edge(u, v);
    add_edge(v, u);
  }
  if (m == n - 1) {
    dfs(1, 1);
    int ans = 0;
    for (int i = 1; i <= n; i++) ans += abs(v[i]);
    printf("%d\n", ans);
    return 0;
  }
}
