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 + 5, M = 20;
long long ans, sum;
int n, h[N], edge[N << 1], nxt[N << 1], cnt, f[N][M], g[N], d[N], dep[N], p, q,
    fa[N], a[N];
bool vis[N];
vector<pair<int, int> > hep[N];
inline void add(int x, int y) {
  edge[++cnt] = y;
  nxt[cnt] = h[x];
  h[x] = cnt;
}
void dfs(int x) {
  f[x][1] = n;
  g[x] = 1;
  for (int i = h[x]; i; i = nxt[i])
    if (edge[i] != fa[x])
      fa[edge[i]] = x, dfs(edge[i]), g[x] = max(g[x], g[edge[i]] + 1);
  ans += g[x];
  for (int j = 2; j < M; j++) {
    int cnt = 0, i;
    for (i = h[x]; i; i = nxt[i])
      if (edge[i] != fa[x] && f[edge[i]][j - 1] > 0)
        a[++cnt] = f[edge[i]][j - 1];
    if (cnt == 0) break;
    sort(a + 1, a + cnt + 1);
    for (i = cnt; i > 0 && cnt - i + 1 <= a[i]; i--)
      ;
    if (i == 0 || cnt - i + 1 > a[i]) i++;
    f[x][j] = cnt - i + 1;
    hep[f[x][j]].push_back(make_pair(x, j));
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  dfs(1);
  sum = n;
  for (int i = 1; i <= n; i++) g[i] = 1;
  for (int k = n; k > 1; k--) {
    vector<pair<int, int> >::iterator it;
    for (it = hep[k].begin(); it != hep[k].end(); it++) {
      pair<int, int> tmp = *it;
      for (int i = tmp.first; i && g[i] < tmp.second; i = fa[i]) {
        sum += tmp.second - g[i];
        g[i] = tmp.second;
      }
    }
    ans += sum;
  }
  printf("%lld\n", ans);
  return 0;
}
