We will recursively define uninity of a tree, as follows: (Uni is a Japanese word for sea urchins.)

* A tree consisting of one vertex is a tree of uninity 0.
* Suppose there are zero or more trees of uninity k, and a vertex v. If a vertex is selected from each tree of uninity k and connected to v with an edge, the resulting tree is a tree of uninity k+1.



It can be shown that a tree of uninity k is also a tree of uninity k+1,k+2,..., and so forth.

You are given a tree consisting of N vertices. The vertices of the tree are numbered 1 through N, and the i-th of the N-1 edges connects vertices a_i and b_i.

Find the minimum k such that the given tree is a tree of uninity k.

Constraints

* 2 ≦ N ≦ 10^5
* 1 ≦ a_i, b_i ≦ N(1 ≦ i ≦ N-1)
* The given graph is a tree.

Input

The input is given from Standard Input in the following format:


N
a_1 b_1
:
a_{N-1} b_{N-1}


Output

Print the minimum k such that the given tree is a tree of uninity k.

Examples

Input

7
1 2
2 3
2 4
4 6
6 7
7 5


Output

2


Input

12
1 2
2 3
2 4
4 5
5 6
6 7
7 8
5 9
9 10
10 11
11 12


Output

3
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,b,a) for(int i=b;i>=a;i--)
#define efo(i,u,v) for(int i=BB[u],v=B[BB[u]][1];i;v=B[i=B[i][0]][1])
#define mset(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
typedef double db;
char ch;
int read(){int n=0,p=1;for(ch=getchar();ch<'0' || '9'<ch;ch=getchar())if(ch=='-') p=-1;for(;'0'<=ch && ch<='9';ch=getchar()) n=n*10+ch-'0';return n*p;}
const int N=1e5+5;
int n,ans,BB[N],B[N<<1][2],B0,f[N],bit[N];
void link(int u,int v){B[++B0][1]=v,B[B0][0]=BB[u],BB[u]=B0;}
void dfs(int v,int fr=1)
{
	efo(i,v,u) if(u!=fr)
	{
		dfs(u,v);
		fo(j,0,20)
			if((bit[v]&bit[u])&(1<<j)) f[v]=max(f[v],j+1);
		bit[v]|=bit[u];
	}
	while(bit[v]&(1<<f[v])) f[v]++;
	bit[v]|=(1<<f[v]);
	fo(j,0,f[v]-1)
		if(bit[v]&(1<<j)) bit[v]^=(1<<j);
	ans=max(ans,f[v]);
}
int main()
{
	int x,y;
	n=read();
	fo(i,1,n-1) x=read(),y=read(),link(x,y),link(y,x);
	dfs(1);
	printf("%d",ans);
	return 0;
}
