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

inline int getint()
{
	static char c;
	while ((c = getchar()) < '0' || c > '9');

	int res = c - '0';
	while ((c = getchar()) >= '0' && c <= '9')
		res = res * 10 + c - '0';
	return res;
}

const int MaxN = 100000;

int n;
vector<int> adj[MaxN + 1];

int sta[MaxN + 1];
int lab[MaxN + 1];

int dfs(int u, int prev)
{
	sta[u] = 0;

	int mask = 0;
	for (int v : adj[u])
		if (v != prev)
		{
			int sv = dfs(v, u);
			mask |= sv & sta[u];
			sta[u] |= sv;
		}

	if (sta[u] == 0)
		sta[u] = 1, lab[u] = 0;
	else
	{
		int l = 0;
		while (1 << l <= mask)
			++l;
		while (sta[u] >> l & 1)
			++l;

		lab[u] = l;
		sta[u] >>= l, sta[u] <<= l;
		sta[u] |= 1 << l;
	}

	return sta[u];
}

int main()
{
	cin >> n;
	for (int i = 1; i < n; ++i)
	{
		int u = getint(), v = getint();
		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	dfs(1, 0);

	cout << *max_element(lab + 1, lab + n + 1);
	cout << endl;

	return 0;
}