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>
inline bool C(int a, int b) { return a > b; }
inline void inc(int &a, const int &b) {
  if (a < b) a = b;
}
struct d {
  d *n;
  int t;
  d(d *a, int b) : n(a), t(b) {}
} * G[300005];
void I(int f, int t) { G[f] = new d(G[f], t); }
int A[300005], M[300005][20], F[300005][20], V[300005], n;
long long T;
void s(int x, int f) {
  V[x] = 1;
  M[x][1] = F[x][1] = n;
  for (d *i = G[x]; i; i = i->n)
    if (i->t != f) s(i->t, x), inc(V[x], V[i->t] + 1);
  for (int i = 2, m; m = 0, i < 19; ++i) {
    for (d *j = G[x]; j; j = j->n)
      if (j->t != f) A[m++] = F[j->t][i - 1];
    std::sort(A, A + m, C);
    A[m] = 0;
    while (F[x][i] < A[F[x][i]]) ++F[x][i];
    inc(F[x][i], 1);
    M[x][i] = F[x][i];
    for (d *j = G[x]; j; j = j->n)
      if (j->t != f) inc(M[x][i], M[j->t][i]);
  }
  M[x][19] = F[x][19] = 1;
  T += V[x];
  for (int i = 1; i < 19; ++i) T += i * (M[x][i] - M[x][i + 1]);
}
int main() {
  scanf("%d", &n);
  for (int i = 1, a, b; i < n; ++i) {
    scanf("%d%d", &a, &b);
    I(a, b);
    I(b, a);
  }
  s(1, 0);
  return !printf("%lld\n", T);
}
