You're given a tree with n vertices rooted at 1.

We say that there's a k-ary heap of depth m located at u if the following holds:

  * For m = 1 u itself is a k-ary heap of depth 1. 
  * For m > 1 vertex u is a k-ary heap of depth m if at least k of its children are k-ary heaps of depth at least m - 1. 



Denote dpk(u) as maximum depth of k-ary heap in the subtree of u (including u). Your goal is to compute <image>.

Input

The first line contains an integer n denoting the size of the tree (2 ≤ n ≤ 3·105). 

The next n - 1 lines contain two integers u, v each, describing vertices connected by i-th edge.

It's guaranteed that the given configuration forms a tree.

Output

Output the answer to the task.

Examples

Input

4
1 3
2 3
4 3


Output

21


Input

4
1 2
2 3
3 4


Output

22

Note

Consider sample case one.

For k ≥ 3 all dpk will be equal to 1.

For k = 2 dpk is 2 if <image> and 1 otherwise.

For k = 1 dpk values are (3, 1, 2, 1) respectively.

To sum up, 4·1 + 4·1 + 2·2 + 2·1 + 3 + 1 + 2 + 1 = 21.
#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 100;
vector<int> G[N];
int dp[N][75];
int sub[N][75];
int dp1[N], dp2[N];
int M, n;
long long ans;
void dfs(int u, int p) {
  int child = 0;
  vector<int> ch_sz;
  for (int v : G[u]) {
    if (v == p) continue;
    dfs(v, u);
    for (int k = 1; k < M; k++) {
      sub[u][k] = max(sub[u][k], sub[v][k]);
    }
    dp1[u] = max(dp1[u], dp1[v]);
    dp2[u] = max(dp2[u], dp2[v]);
    child++;
    ch_sz.push_back(G[v].size() - 1);
  }
  sort(ch_sz.rbegin(), ch_sz.rend());
  for (int k = 1; k <= min(child, M - 1); k++) {
    vector<int> opts;
    for (int v : G[u]) {
      if (v == p) continue;
      opts.push_back(-dp[v][k]);
    }
    nth_element(opts.begin(), opts.begin() + k - 1, opts.end());
    dp[u][k] = max(dp[u][k], -opts[k - 1] + 1);
  }
  for (int k = 1; k < M; k++) {
    sub[u][k] = max(sub[u][k], dp[u][k]);
    ans += sub[u][k] + 1;
  }
  if (ch_sz.size() > 0 && ch_sz[0] > 0) {
    int lo = 1, hi = ch_sz.size();
    while (hi > lo) {
      int mid = (hi + lo + 1) / 2;
      if (ch_sz[mid - 1] >= mid)
        lo = mid;
      else
        hi = mid - 1;
    }
    dp1[u] = max(dp1[u], lo);
  }
  dp2[u] = max(dp2[u], (int)ch_sz.size());
  ans += (n - M + 1);
  if (dp1[u] >= M) ans += (dp1[u] - M + 1);
  if (dp2[u] >= M) ans += (dp2[u] - M + 1);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  M = min(70, n + 1);
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(1, -1);
  cout << ans << endl;
  return 0;
}
