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;
struct point {
  int id, d;
};
vector<point> p[300010];
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
struct node {
  int x, y, next;
} a[600010];
int len, last[300010];
inline void ins(int x, int y) {
  len++;
  a[len].x = x;
  a[len].y = y;
  a[len].next = last[x];
  last[x] = len;
}
long long ans;
int top, sta[300010], f[300010][20], fa[300010], mx[300010];
inline void dfs(int x) {
  mx[x] = 1;
  for (int k = last[x]; k; k = a[k].next) {
    int y = a[k].y;
    if (y == fa[x]) continue;
    fa[y] = x;
    dfs(y);
    mx[x] = max(mx[x], mx[y] + 1);
  }
  ans += mx[x];
  for (int i = 2; i <= 18; i++) {
    int top = 0;
    for (int k = last[x]; k; k = a[k].next) {
      int y = a[k].y;
      if (y == fa[x]) continue;
      sta[++top] = f[y][i - 1];
    }
    sort(sta + 1, sta + top + 1);
    int cnt = 0;
    for (int j = top; j >= 1; j--) {
      cnt++;
      if (sta[j] >= cnt)
        f[x][i] = cnt;
      else
        break;
    }
    point wy;
    wy.id = x, wy.d = i;
    p[f[x][i]].push_back(wy);
  }
}
int g[300010];
int main() {
  int n = read();
  for (int i = 1; i < n; i++) {
    int x = read(), y = read();
    ins(x, y), ins(y, x);
  }
  for (int i = 1; i <= n; i++) f[i][1] = n;
  dfs(1);
  for (int i = 1; i <= n; i++) g[i] = 1;
  long long sum = n;
  for (int i = n; i > 1; i--) {
    for (int j = 0; j < p[i].size(); j++) {
      int x = p[i][j].id, d = p[i][j].d;
      while (x && g[x] < d) sum += d - g[x], g[x] = d, x = fa[x];
    }
    ans += sum;
  }
  printf("%lld\n", ans);
  return 0;
}
