/*
TASK:man
LANG:C++
*/
#define MAXN 4100

#include <iostream>
#include <queue>

using namespace std;

queue<int> Q;

bool a[MAXN][MAXN];
int m, n;
int br, i, j;

bool con (int u, int v)
         {
              bool used[MAXN]={0};
              
              if (u==v) return true;
              
              used[u]=true;
              while (!Q.empty()) Q.pop();
              Q.push(u);
              
              while (!Q.empty())
                    { 
                                u=Q.front();
                                Q.pop();
                                
                                for (int t=0; t<=n; t++)
                                    if (a[u][t]&&(!used[t]))
                                       {
                                                          if (t==v) return true;
                                                          Q.push(t);
                                                          used[t]=1;
                                       }
                   }
              
              return false;
         }

int main()
{
    scanf("%d", &m);
    
    for (i=1; i<=m; i++)
        {
             int x, y;
             
             scanf("%d%d", &x, &y);
             
             if (x>n) n=x;
             if (y>n) n=y;
             
             if (!con(x,y)) { a[x][y]=a[y][x]=true; br++; }
        }
    
    printf("%d\n", br);
    
return 0;
}

