#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, m, x, y, c = 0;
  cin >> n >> m;
  vector<list<int> > stud(n + 1);
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    stud[x].push_back(y), stud[y].push_back(x);
  }
  bool ok = 0;
  vector<pair<int, int> > temp;
  while (true) {
    for (int i = 1; i < n + 1; i++)
      if (stud[i].size() == 1) temp.push_back(make_pair(i, stud[i].front()));
    for (int i = 0; i < temp.size(); i++) {
      stud[temp[i].second].remove(temp[i].first);
      stud[temp[i].first].remove(temp[i].second);
      ok = 1;
    }
    if (!ok)
      break;
    else
      c += ok;
    ok = 0, temp.clear();
  }
  cout << c;
}
