#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

struct node { int t,next; }a[200010];

int head[100010],bit[100010],f[100010],n,ans,tot;

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

inline void add(int x,int y) { a[++tot].t=y;a[tot].next=head[x];head[x]=tot; }

inline void dfs(int x,int y)
{
	bit[x]=f[x]=0;
	int hh=0;
	for (int i=head[x];i;i=a[i].next)
	{
		int t=a[i].t;
		if (t==y) continue;
		dfs(t,x);
		hh|=(bit[x]&bit[t]);
		bit[x]|=bit[t];
	}
	if (!bit[x]) bit[x]=1;
	else
	{
		while ((1<<f[x])<hh||((1<<f[x])&bit[x])) f[x]++;
		bit[x]=(bit[x]>>f[x]<<f[x])|(1<<f[x]);
	}
	ans=max(ans,f[x]);
}

int main()
{
	n=rd();tot=0;
	for (int i=1;i<n;i++)
	{
		int x=rd(),y=rd();
		add(x,y);add(y,x);
	}
	ans=0;dfs(1,0);
	printf("%d\n",ans);
	return 0;
}