#include<iostream>
#include<set>

using namespace std;

multiset<int> edges[523];

void erase(int v){
  while(edges[v].size()==1){
    int nv=*edges[v].begin();
    edges[nv].erase(edges[nv].find(v));
    edges[v].clear();
    v=nv;
  }
}    

int main(){
  int N,M;
  cin>>N>>M;
  for(int i=0;i<M;i++){
    int s,t;
    cin>>s>>t;
    edges[s].insert(t);
    edges[t].insert(s);
  }
  int ans=0;
  for(;;){
    int m=1e9;
    int x;
    for(int i=1;i<=N;i++){
      if(!edges[i].empty()&&edges[i].size()<m){
	m=edges[i].size();
	x=i;
      }
    }
    if(m>1e8)break;
    while(!edges[x].empty()){
      ans++;
      auto it=edges[x].begin();
      int t=*it;
      edges[x].erase(it);
      edges[t].erase(edges[t].find(x));
      erase(t);
      erase(x);
    }
  }
  cout<<ans<<endl;
}