#include <bits/stdc++.h>
using namespace std;
vector<int> G[100010];
bool vis[100010];
int n, m;
bool cmp(int a, int b) { return a > b; }
int bfs(int v) {
  queue<int> q;
  q.push(v);
  vector<int> deg;
  int sum = 0;
  vis[v] = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    int n = (G[u]).size();
    deg.push_back(n);
    sum += n;
    for (int i = 0; i < (n); ++i) {
      int w = G[u][i];
      if (!vis[w]) {
        q.push(w);
        vis[w] = true;
      }
    }
  }
  if ((deg).size() > 1) {
    sort((deg).begin(), (deg).end(), cmp);
    int rem = sum / 2;
    for (int i = 0; i < ((deg).size()); ++i) {
      if (deg[i] > 1) {
        rem -= deg[i] - 1;
        if (rem <= 0) {
          rem = 0;
          break;
        }
      } else
        break;
    }
    return rem;
  } else
    return 1;
}
int main() {
  scanf("%d%d", &(n), &(m));
  for (int i = 0; i < (m); ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  int cnt = 0;
  for (int i = 1; i <= (n); ++i)
    if (!vis[i]) cnt += bfs(i);
  printf("%d\n", cnt);
  return 0;
}
