#include<bits/stdc++.h>
using namespace std;
vector <int> des[100010];
int dfs(int s,int pre=0)
{
	int all=0,dou=0,p=0;
	for (int k=0;k<des[s].size();k++) if (des[s][k]!=pre) {int p=dfs(des[s][k],s);dou|=all&p;all|=p;}
	while (((1<<p)<dou)||(all&(1<<p))) p++;
	return (all>>p<<p)|(1<<p);
}
int main()
{
	int n;scanf("%d",&n);
	for (int i=1;i<n;i++)
	{
		int u,v;scanf("%d%d",&u,&v);
		des[u].push_back(v);
		des[v].push_back(u);
	}
	printf("%d\n",(int)log2(dfs(1)));
}