#include <bits/stdc++.h>
using namespace std;
int n, cnt, m;
int ln, lev, rn, tn, down[2010];
vector<int> edg[2010];
set<int> tree[2010];
int vis[2010], low[2010], dfn[2010];
int p, st[2010], idx[2010];
void CutEdge(int u, int father, int deep) {
  vis[u] = 1;
  dfn[u] = low[u] = deep;
  st[p++] = u;
  for (int i = 0; i < edg[u].size(); i++) {
    int v = edg[u][i];
    if (v == father) continue;
    if (vis[v] == 1) {
      low[u] = min(low[u], dfn[v]);
    } else if (vis[v] == -1) {
      CutEdge(v, u, deep + 1);
      low[u] = min(low[u], low[v]);
      if (low[v] > dfn[u]) {
        do {
          idx[st[--p]] = cnt;
        } while (st[p] != v);
        cnt++;
      }
    }
  }
  vis[u] = 2;
}
void ClearCircle() {
  memset(vis, -1, sizeof(vis));
  cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i] != -1) continue;
    p = 0;
    CutEdge(i, -1, 1);
    while (p) idx[st[--p]] = cnt;
    cnt++;
  }
  for (int i = 1; i <= cnt; i++) tree[i].clear();
  for (int u = 1; u <= n; u++) {
    for (int i = 0; i < edg[u].size(); i++) {
      int v = edg[u][i];
      if (idx[u] == idx[v]) continue;
      tree[idx[u]].insert(idx[v]);
    }
  }
}
void MaxLine(int u, int father) {
  vis[u] = 1;
  if (tree[u].size() <= 1) lev += 1;
  int a = 0, b = 0;
  for (set<int>::iterator it = tree[u].begin(); it != tree[u].end(); it++) {
    int v = *it;
    if (v == father) continue;
    if (vis[v] == -1) {
      MaxLine(v, u);
    }
    if (down[v] > a) {
      b = a;
      a = down[v];
    } else if (down[v] > b) {
      b = down[v];
    }
  }
  down[u] = a + 1;
  ln = max(ln, a + b + 1);
}
int main(int argc, char** argv) {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) edg[i].clear();
  int a, b;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    edg[a].push_back(b);
    edg[b].push_back(a);
  }
  ClearCircle();
  rn = 0;
  tn = 0;
  memset(vis, -1, sizeof(vis));
  for (int i = 1; i <= cnt; i++) {
    if (vis[i] == 1) continue;
    ln = 0;
    lev = 0;
    MaxLine(i, -1);
    if (ln == 1 && lev == 1)
      rn += 1;
    else
      rn += ln + lev - 2;
    tn += 1;
  }
  cout << n - rn + tn - 1 << endl;
  return (EXIT_SUCCESS);
}
