#include <bits/stdc++.h>   using namespace std;   int n, m, cnt, flag;   vector<int> graph[100005];   bool vis[100005];   void dfs(int node, int parent) {     vis[node] = 1;     int x, u, v, i;     cnt++;     for (i = 0; i < graph[node].size(); i++) {       v = graph[node][i];       if (v == parent) continue;       if (vis[v] == 1)         flag = 1;       else         dfs(v, node);     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m;     int i, j, k, u, v, x, sum = 0;     for (i = 0; i < m; i++) {       cin >> u >> v;       graph[u].push_back(v);       graph[v].push_back(u);     }     for (i = 1; i <= n; i++) {       if (vis[i] == 0) {         cnt = 0;         flag = 0;         dfs(i, 0);         if (flag == 1)           sum += cnt;         else           sum += (cnt - 1);       }     }     cout << n - sum << endl;   }   