#include <bits/stdc++.h>
using namespace std;
vector<int> g[100005];
int U[100005], V[100005];
vector<pair<int, int> > nodes;
int m1[100005];
int m2[100005];
int seen[100005];
int id;
bool dfs(int node) {
  for (int i = 0; i < int(g[node].size()); i++) {
    int ind = g[node][i];
    if (m2[ind] == -1) {
      m2[ind] = node;
      m1[node] = ind;
      return true;
    }
  }
  for (int i = 0; i < int(g[node].size()); i++) {
    int ind = g[node][i];
    if (seen[ind] == id) continue;
    int brother = m2[ind];
    seen[ind] = id;
    m1[node] = ind;
    m2[ind] = node;
    m1[brother] = -1;
    if (dfs(brother)) return true;
    m1[node] = -1;
    m2[ind] = brother;
    m1[brother] = node;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    --u;
    --v;
    g[u].push_back(i);
    g[v].push_back(i);
    U[i] = min(u, v), V[i] = max(u, v);
    m2[i] = -1;
  }
  for (int node = 0; node < n; node++)
    nodes.push_back(make_pair(int(g[node].size()), node)), m1[node] = -1;
  sort(nodes.begin(), nodes.end());
  int ans = 0;
  id = 1;
  for (int i = 0; i < n; i++, id++)
    if (!dfs(nodes[i].second)) ans++;
  cout << ans << endl;
  return 0;
}
