#include <bits/stdc++.h>
using namespace std;
const int N = 2100, M = 100100;
int n, m, cp = 1;
int a[M], b[M];
int hd[N], ot[M << 1], nt[M << 1];
int low[N], zh[N], E[N], B[N], g[N];
int ans = -1, S = 0, len = 0, f[N];
void add(const int x, const int y) {
  ot[++cp] = y, nt[cp] = hd[x], hd[x] = cp;
  ot[++cp] = x, nt[cp] = hd[y], hd[y] = cp;
}
void dfs(const int x, const int F) {
  zh[low[x] = (++len)] = x;
  int now = len;
  for (int i = hd[x]; i != 0; i = nt[i])
    if (i != F) {
      if (low[ot[i]] == 0) dfs(ot[i], i ^ 1);
      if (low[ot[i]] < low[x]) low[x] = low[ot[i]];
    }
  if (now == low[x]) {
    ++S;
    for (int i = now; i <= len; ++i) E[zh[i]] = S;
    ans += len - now;
    len = now - 1;
  }
}
void Gans(const int x) {
  B[1] = x;
  int h = 1, t = 1, now, A = 0, sum = 0;
  for (; h <= t; ++h) {
    now = B[h];
    for (int i = hd[now]; i != 0; i = nt[i])
      if (ot[i] != f[now]) f[B[++t] = ot[i]] = now;
  }
  for (h = t; h > 0; --h) {
    int w = 0, e = 0;
    now = B[h];
    g[now] = 0;
    for (int i = hd[now]; i != 0; i = nt[i])
      if (ot[i] != f[now]) {
        ++w;
        if (g[now] + g[ot[i]] > e) e = g[now] + g[ot[i]];
        if (g[ot[i]] > g[now]) g[now] = g[ot[i]];
      }
    if (w == 0 || w == 1 && now == x) {
      ++sum;
      continue;
    }
    ++g[now];
    if (g[now] > A) A = g[now];
    if (e + 1 > A) A = e + 1;
  }
  ans += t - A - sum;
}
int main() {
  memset(hd, 0, sizeof(hd));
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) scanf("%d%d", &a[i], &b[i]), add(a[i], b[i]);
  for (int i = 1; i <= n; ++i)
    if (low[i] == 0) dfs(i, 0), ++ans;
  memset(hd, 0, sizeof(hd)), cp = 0;
  for (int i = 1; i <= m; ++i)
    if ((a[i] = E[a[i]]) != (b[i] = E[b[i]])) add(a[i], b[i]);
  for (int i = 1; i <= S; ++i)
    if (f[i] == 0) Gans(i);
  printf("%d\n", ans);
  return 0;
}
