#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const long long MINT = ~0u >> 1;
const int maxn = 123456;
set<int> Set[maxn];
bool isOk[maxn];
int n, m;
void solve() {
  queue<int> q;
  for (int i = 1; i <= n; i++) {
    if (1 == Set[i].size()) {
      q.push(i);
    }
  }
  while (!q.empty()) {
    int cur = q.front();
    if (1 == Set[cur].size()) {
      isOk[cur] = true;
      int temp = *(Set[cur].begin());
      Set[cur].erase(temp);
      Set[temp].erase(cur);
      if (1 == Set[temp].size()) q.push(temp);
      q.pop();
    } else
      q.pop();
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    Set[x].insert(y);
    Set[y].insert(x);
  }
  solve();
  int ans(0);
  for (int i = 1; i <= n; i++) {
    if (!Set[i].size() && !isOk[i]) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
