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;
long long ans = 0;
int n, f1[300010], dp[300010][20], fa[300010], buf[300010], dep[300010];
vector<int> v[300010];
vector<pair<int, int> > upd[300010];
void dfs(int np, int fath) {
  f1[np] = 1;
  fa[np] = fath;
  for (int &x : v[np]) {
    if (x == fath) continue;
    dfs(x, np);
    f1[np] = max(f1[np], f1[x] + 1);
  }
  dp[np][1] = n;
  for (int i = 2; i < 20; i++) {
    int tp = 0;
    for (int &x : v[np]) {
      if (x == fath) continue;
      buf[++tp] = dp[x][i - 1];
    }
    sort(buf + 1, buf + tp + 1, greater<int>());
    for (int j = tp; j >= 1; j--) {
      if (buf[j] >= j) {
        dp[np][i] = j;
        break;
      }
    }
    if (dp[np][i] > 1) upd[dp[np][i]].push_back(make_pair(np, i));
  }
  ans += f1[np];
}
long long cur = 0;
void update(int x, int y) {
  while (x) {
    if (dep[x] >= y) return;
    cur += y - dep[x];
    dep[x] = y;
    x = fa[x];
  }
}
int main() {
  scanf("%d", &n);
  fill(dep + 1, dep + n + 1, 1);
  cur = n;
  for (int i = 1, ti, tj; i < n; i++) {
    scanf("%d%d", &ti, &tj);
    v[ti].push_back(tj);
    v[tj].push_back(ti);
  }
  dfs(1, 0);
  for (int i = n; i >= 2; i--) {
    for (auto &x : upd[i]) update(x.first, x.second);
    ans += cur;
  }
  printf("%lld\n", ans);
  return 0;
}
