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;
int n, sl, fh, cnt, s[1000010], fa[1000010], dp[1000010], mxd[1000010],
    f[1000010][20];
long long res, ans;
int t, h[1000010];
struct Tre {
  int to, nxt;
} e[1000010 << 1];
vector<pair<int, int> > vt[1000010];
int rd() {
  sl = 0;
  fh = 1;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') sl = sl * 10 + ch - '0', ch = getchar();
  return sl * fh;
}
void add(int u, int v) {
  e[++t] = (Tre){v, h[u]};
  h[u] = t;
  e[++t] = (Tre){u, h[v]};
  h[v] = t;
}
void dfs(int u) {
  int v;
  f[u][1] = n;
  mxd[u] = 1;
  for (int i = h[u]; i; i = e[i].nxt)
    if ((v = e[i].to) != fa[u])
      fa[v] = u, dfs(v), mxd[u] = max(mxd[u], mxd[v] + 1);
  ans += mxd[u];
  for (int i = 2; i < 20; ++i) {
    cnt = 0;
    for (int j = h[u]; j; j = e[j].nxt)
      if ((v = e[j].to) != fa[u]) s[++cnt] = f[v][i - 1];
    sort(s + 1, s + cnt + 1, [&](const int &x, const int &y) { return x > y; });
    for (v = 0; v < cnt && s[v + 1] > v; ++v)
      ;
    f[u][i] = v;
    vt[v].push_back(make_pair(u, i));
  }
}
void upd(int x, int v) {
  for (; x && dp[x] < v; x = fa[x]) res += v - dp[x], dp[x] = v;
}
int main() {
  n = rd();
  int x, y;
  for (int i = 1; i < n; ++i) x = rd(), y = rd(), add(x, y);
  dfs(1);
  for (int i = 1; i <= n; ++i) dp[i] = 1;
  res = n;
  for (int k = n; k > 1; --k) {
    for (auto i : vt[k]) upd(i.first, i.second);
    ans += res;
  }
  printf("%lld\n", ans);
  return 0;
}
