/*
TASK:man
LANG:C++
*/
#include<iostream>
using namespace std;
int atop=0,btop=0;
int a[20000][2];
int b[20000][2];
void check(int q,int w)
{
     for(int i=0;i<atop;i++)
     {
     if(q==a[i][0]) {b[btop][0]=w;b[btop++][1]=a[i][1];continue;}
     if(q==a[i][1]) {b[btop][0]=w;b[btop++][1]=a[i][0];continue;}
     if(w==a[i][0]) {b[btop][0]=q;b[btop++][1]=a[i][1];continue;}
     if(w==a[i][1]) {b[btop][0]=q;b[btop++][1]=a[i][0];continue;}
     }
     a[atop][0]=q;
     a[atop++][1]=w;
}
int checked(int q,int w)
{
    for(int i=0;i<btop;i++)
    if((q==b[i][0] || q==b[i][1]) && (w==b[i][0] || w==b[i][1])) return 1;
    return 0;
}
int main()
{
    int m,q,w;
    cin>>m;
    for(int i=0;i<m;i++)
    {
    cin>>q>>w;
    if(checked(q,w)) continue;
    check(q,w);
    }
    cout<<atop<<endl;
    //system("pause");
    return 0;
}
