#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
using namespace std;
namespace _c {
const double pi = acos(-1.0);
namespace min {
const int i8 = -128;
const int i16 = -32768;
const int i = -2147483647 - 1;
const long long l = -9223372036854775807LL - 1;
}  // namespace min
namespace max {
const int i8 = 127;
const int i16 = 32767;
const int i = 2147483647;
const long long l = 9223372036854775807LL;
}  // namespace max
}  // namespace _c
namespace _f {
template <typename T>
inline const T gcd(T m, T n) {
  while (n != 0) {
    T t = m % n;
    m = n;
    n = t;
  }
  return m;
}
template <typename T>
inline const T max(const T &a, const T &b) {
  return a > b ? a : b;
}
template <typename T>
inline const T min(const T &a, const T &b) {
  return a < b ? a : b;
}
template <typename T>
inline const T abs(const T &a) {
  return a > 0 ? a : -a;
}
template <typename T>
inline T pow(T a, T b) {
  T res = 1;
  while (b > 0) {
    if (b & 1) {
      res = res * a;
    }
    a = a * a;
    b >>= 1;
  }
  return res;
}
template <typename T>
inline T pow(T a, T b, const T &m) {
  a %= m;
  T res = 1;
  while (b > 0) {
    if (b & 1) {
      res = res * a % m;
    }
    a = a * a % m;
    b >>= 1;
  }
  return res % m;
}
}  // namespace _f
namespace io {
template <typename T>
inline void read(T &t) {
  register T res = 0, neg = 1;
  char g = getchar();
  for (; !isdigit(g); g = getchar()) {
    if (g == '-') {
      neg = -1;
    }
  }
  for (; isdigit(g); g = getchar()) {
    res = res * 10 + g - '0';
  }
  t = res * neg;
}
inline int in() {
  register int T;
  read(T);
  return T;
}
inline long long in_ll() {
  register long long T;
  read(T);
  return T;
}
}  // namespace io
int n, m, ans, de[1000005], siz[1000005], ori[1000005], vis[1000005],
    lin[1000005][2];
int find(int x) { return !ori[x] ? x : ori[x] = find(ori[x]); }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &lin[i][0], &lin[i][1]);
    de[lin[i][0]]++;
    de[lin[i][1]]++;
  }
  for (int i = 1; i <= n; i++) ans += (siz[i] = de[i] % 2);
  ans /= 2;
  for (int i = 1, s1, s2; i <= m; i++) {
    s1 = find(lin[i][0]);
    s2 = find(lin[i][1]);
    if (s1 == s2) continue;
    ori[s2] = s1;
    siz[s1] = siz[s1] + siz[s2];
  }
  int flag = 1;
  for (int i = 1; i <= n; i++) {
    int s = find(i);
    flag = flag & (i == 1 || find(i) == find(i - 1) || de[i] == 0);
    if (!vis[s] && (de[i] != 0 || i == 1)) ans += (siz[s] == 0), vis[s] = 1;
  }
  if ((flag && siz[find(1)] == 0)) {
    puts("0");
    return 0;
  }
  printf("%d\n", ans);
}
