#include<iostream>
#include<algorithm>
using namespace std;
int count(int arr[], int x, int n) 
{     
	int *low = lower_bound(arr, arr+n, x); 
	if (low == (arr + n) || *low != x) 
	    return 0;   
	int *high = upper_bound(low, arr+n, x);      
	return high - low; 
} 
main()
{
	int N,brojac=0;
	scanf("%d",&N);
	int niz[(N-1)*2],ponavljanja[(N-1)*2];
	for(int i=0;i<(N-1)*2;i=i+2)
		scanf("%d%d",&niz[i],&niz[i+1]);
	sort(niz,niz+sizeof(niz)/sizeof(niz[0]));
	for(int i=0;i<(N-1)*2;i++)
	{
		if(niz[i]==niz[i+1])
		{
			ponavljanja[brojac]=0;
			brojac++;
		}
		else
		{
			ponavljanja[brojac]=count(niz,niz[i],sizeof(niz)/sizeof(niz[0]));
			brojac++;
		}
	}
	//for(int i=0;i<(N-1)*2;i++)
	//	printf("%d ",ponavljanja[i]);
	//printf("\n");
	for(int i=0;i<(N-1)*2;i++)
	{
		if(ponavljanja[i]==N-1)
		{
			printf("2");
			return 0;
		}
	}
	printf("1");
	return 0;
}