// Crt. 2019-12-08  09:24:29
// give $ v $ a val. of k + 1
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#define N 200005
using namespace std;

int n, num[N][22], val[N], ans;
int tot, fir[N], nxt[N << 1], to[N << 1];

inline void addE(int u, int v) {
    nxt[++tot] = fir[u], fir[u] = tot, to[tot] = v;
}

void dfs(int u, int p) {
    for (int i = fir[u], v; i; i = nxt[i]) {
        v = to[i];
        if (v == p) continue;
        dfs(v, u);
        for (int j = 0; j <= 20; ++j)
            num[u][j] += num[v][j];
    }
    for (int i = 0; i <= 20; ++i)
        if (num[u][i] > 1) val[u] = max(val[u], i);
    while (num[u][val[u]]) ++val[u];
    for (int i = 0; i < val[u]; ++i)
        num[u][i] = 0;
    num[u][val[u]] = 1;
    ans = max(ans, val[u]);
}

int main() {
#ifdef LOCAL_JUDGE
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    cin >> n;
    for (int i = 1, u, v; i < n; ++i)
        scanf("%d%d", &u, &v), addE(u, v), addE(v, u);

    dfs(1, 0);

    cout << ans << endl;

    return 0;
}
