#include <bits/stdc++.h>
struct node {
  int key, dop;
  unsigned short int height;
  node *left, *right;
  node(int k, int d) {
    key = k;
    left = 0;
    right = 0;
    height = 1;
    dop = d;
  }
};
unsigned short int height(node *p) { return p ? p->height : 0; }
short int bfactor(node *p) { return height(p->left) - height(p->right); }
void fixheight(node *p) {
  unsigned short int h1, h2;
  h1 = height(p->left);
  h2 = height(p->right);
  p->height = (h1 > h2 ? h1 : h2) + 1;
}
node *rotateR(node *q) {
  node *p = q->left;
  q->left = p->right;
  p->right = q;
  fixheight(q);
  fixheight(p);
  return p;
}
node *rotateL(node *p) {
  node *q = p->right;
  p->right = q->left;
  q->left = p;
  fixheight(p);
  fixheight(q);
  return q;
}
node *balance(node *p) {
  fixheight(p);
  if (bfactor(p) == 2) {
    if (bfactor(p->left) < 0) p->left = rotateL(p->left);
    return rotateR(p);
  }
  if (bfactor(p) == -2) {
    if (bfactor(p->right) > 0) p->right = rotateR(p->right);
    return rotateL(p);
  }
  return p;
}
node *insert(node *p, int k, int d) {
  if (!p) return new node(k, d);
  if (p->key < k)
    p->right = insert(p->right, k, d);
  else
    p->left = insert(p->left, k, d);
  return (balance(p));
}
void printyem(node *kor) {
  if (kor) {
    printyem(kor->left);
    printf("%d", kor->key);
    printyem(kor->right);
  }
}
node *kor;
bool done[100001];
int n, k, reb[200002][2], a, b, kol[100001], wher[100001], och;
void obh(node *kor) {
  if (kor->left) obh(kor->left);
  a++;
  if (kor->key != reb[a - 1][0]) wher[kor->key] = a;
  reb[a][0] = kor->key;
  reb[a][1] = kor->dop;
  if (kor->right) obh(kor->right);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < k; i++) {
    scanf("%d%d", &a, &b);
    kor = insert(kor, a, b);
    kor = insert(kor, b, a);
    kol[a]++;
    kol[b]++;
  }
  a = 0;
  b = 0;
  obh(kor);
  for (int i = 1; i <= n; i++) {
    if (kol[i] == 1) {
      och = i;
      while (kol[och] == 1) {
        done[och] = true;
        kol[och]--;
        a = wher[och];
        while (done[reb[a][1]]) a++;
        och = reb[a][1];
        kol[och]--;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    if (kol[i] == 0 && !done[i]) b++;
  printf("%d", b);
}
