#include <bits/stdc++.h>
using namespace std;
bool vis[100100];
vector<int> v[100100];
int d[100100];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  queue<int> q;
  for (int i = 1; i <= n; i++) {
    d[i] = v[i].size();
    if (v[i].size() == 1) q.push(i);
  }
  int cnt = 0;
  while (q.size()) {
    int x = q.front();
    q.pop();
    vis[x] = 1;
    if (d[x] > 0) cnt++;
    for (int y : v[x]) {
      if (vis[y]) continue;
      d[y]--;
      if (d[y] == 1) q.push(y);
    }
  }
  int num = 0;
  for (int i = 1; i <= n; i++) {
    if (d[i] <= 1) num++;
  }
  cout << max(0, n - cnt - (n - num)) << endl;
  return 0;
}
