#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int N = 3e5 + 10;
int n, deg[N], v[N][2], mark[N];
vector<int> e[N];
queue<int> q;
void prepare() {
  int m, x, y;
  scanf("%d%d", &n, &m);
  for (auto i = (1); i <= (m); i++) {
    scanf("%d%d", &x, &y);
    v[i][0] = x;
    v[i][1] = y;
    e[x].push_back(i);
    e[y].push_back(i);
    deg[x]++, deg[y]++;
  }
}
int solve() {
  for (auto i = (1); i <= (n); i++)
    if (deg[i] == 1) q.push(i);
  int ans = 0;
  for (auto i = (1); i <= (n); i++)
    if (!deg[i]) ans++;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    if (deg[x] == 0) ans++;
    for (auto i : e[x])
      if (!mark[i]) {
        mark[i] = 1;
        for (auto j = (0); j <= (1); j++) {
          int y = v[i][j];
          deg[y]--;
          if (deg[y] == 1) q.push(y);
        }
      }
  }
  return ans;
}
int main() {
  prepare();
  cout << solve();
}
