#include <bits/stdc++.h>
using namespace std;
const int N = 2009;
const int M = 1e5 + 9;
int n, m;
struct Graph {
  int sz;
  int head[N];
  int to[M << 1];
  int ne[M << 1];
  Graph() {
    sz = 1;
    memset(head, 0, sizeof head);
  }
  inline void add_edge(int u, int v) {
    to[sz] = u, ne[sz] = head[v], head[v] = sz++;
  }
} G, T;
int dfn[N];
int low[N];
int tim;
int bel[N], tot;
int st[N], top;
int deg[N];
int maxdis;
int node;
int ans;
inline int id(int x) { return (x + 1) >> 1; }
void tarjan(int now, int fe) {
  dfn[now] = low[now] = ++tim;
  st[++top] = now;
  for (int i = G.head[now]; i; i = G.ne[i])
    if (!dfn[G.to[i]]) {
      tarjan(G.to[i], i);
      low[now] = min(low[now], low[G.to[i]]);
    } else if (id(i) != id(fe))
      low[now] = min(low[now], dfn[G.to[i]]);
  if (dfn[now] == low[now]) {
    ++tot;
    int p;
    do {
      p = st[top--];
      bel[p] = tot;
    } while (p != now);
  }
}
void dfs(int now, int fa, int dis) {
  dfn[now] = 1;
  if (maxdis < dis) maxdis = dis, node = now;
  for (int i = T.head[now]; i; i = T.ne[i])
    if (T.to[i] != fa) dfs(T.to[i], now, dis + 1);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    G.add_edge(u, v);
    G.add_edge(v, u);
  }
  for (int i = 1; i <= n; ++i)
    if (!dfn[i]) tarjan(i, 0);
  for (int i = 1; i <= n; ++i)
    for (int j = G.head[i]; j; j = G.ne[j])
      if (bel[i] != bel[G.to[j]]) {
        T.add_edge(bel[i], bel[G.to[j]]);
        deg[bel[i]]++;
      }
  memset(dfn, 0, sizeof dfn);
  for (int i = 1; i <= tot; ++i) {
    if (!dfn[i]) {
      maxdis = 0, dfs(i, 0, 1);
      maxdis = 0, dfs(node, 0, 1);
      if (maxdis == 1)
        ans--;
      else
        ans += maxdis - 3;
    }
    if (deg[i] <= 1) ans++;
  }
  printf("%d\n", n - ans - 1);
  return 0;
}
