#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int degree[n + 1];
  for (int i = 0; i <= n; i++) degree[i] = 0;
  int u, v;
  vector<set<int> > G(n + 1, set<int>());
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    G[u].insert(v);
    G[v].insert(u);
    degree[u]++;
    degree[v]++;
  }
  int separate = 0;
  queue<int> q;
  for (int i = 1; i < n + 1; i++)
    if (degree[i] == 1)
      q.push(i);
    else if (degree[i] == 0)
      separate++;
  while (!q.empty()) {
    int i = q.front();
    q.pop();
    for (auto k : G[i]) {
      G[k].erase(i);
      degree[k]--;
      if (degree[k] == 1)
        q.push(k);
      else if (degree[k] == 0)
        separate++;
    }
  }
  cout << separate << endl;
  return 0;
}
