#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, e, f, g, h[1000005], i, j, k;
int D[1000005];
int father[1000005];
vector<int> GG;
int an;
int Find(int x) {
  if (father[x] == x)
    return x;
  else {
    father[x] = Find(father[x]);
    return father[x];
  }
}
void HB(int x, int y) {
  x = Find(x);
  y = Find(y);
  father[x] = y;
}
int main() {
  scanf("%d%d", &a, &b);
  for (i = 1; i <= a; i++) father[i] = i;
  for (i = 1; i <= b; i++) {
    scanf("%d%d", &c, &d);
    D[c]++;
    D[d]++;
    HB(c, d);
  }
  for (i = 1; i <= a; i++)
    if (D[i] & 1) {
      an++;
      h[Find(i)] = 1;
    }
  for (i = 1; i <= a; i++) GG.push_back(Find(i));
  for (i = 1; i <= a; i++) h[i] += h[i - 1];
  an >>= 1;
  for (i = 2; i <= a; i++) e += D[i] == 0;
  sort(GG.begin(), GG.end());
  GG.erase(unique(GG.begin(), GG.end()), GG.end());
  if (GG.size() - e == 1 && an <= 0) {
    printf("0\n");
    return 0;
  }
  an += GG.size() - h[a];
  an -= e;
  printf("%d\n", an);
  return 0;
}
