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;
template <class T1, class T2>
inline void upd1(T1& a, T2 b) {
  a > b ? a = b : 0;
}
template <class T1, class T2>
inline void upd2(T1& a, T2 b) {
  a < b ? a = b : 0;
}
struct ano {
  operator long long() {
    long long x = 0, y = 0, c = getchar();
    while (c < 48) y = c == 45, c = getchar();
    while (c > 47) x = x * 10 + c - 48, c = getchar();
    return y ? -x : x;
  }
} buf;
const int N = 3e5 + 5;
vector<int> t[N];
long long s = 0;
int n, f[20][N], g[20][N];
int dfs(int u, int p) {
  int l = 1;
  for (int v : t[u])
    if (v != p) upd2(l, dfs(v, u) + 1);
  s += l;
  f[1][u] = n;
  g[1][u] = n;
  for (int i = 2;; ++i) {
    vector<int> a;
    for (int v : t[u])
      if (v != p) a.push_back(-f[i - 1][v]);
    sort(a.begin(), a.end());
    f[i][u] = 1;
    for (int k = a.size(); k > 1; --k)
      if (-a[k - 1] >= k) {
        f[i][u] = k;
        break;
      }
    if (f[i][u] == 1) break;
  }
  for (int i = 2;; ++i) {
    for (int v : t[u])
      if (v != p) upd2(g[i][u], g[i][v]);
    upd2(g[i][u], f[i][u]);
    s += (i - 1) * (g[i - 1][u] - g[i][u]);
    if (g[i][u] == 1) break;
  }
  return l;
}
int main() {
  n = buf;
  for (int i = 2; i <= n; ++i) {
    int u = buf, v = buf;
    t[u].push_back(v);
    t[v].push_back(u);
  }
  dfs(1, 0);
  printf("%lld\n", s);
}
