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 long long int Maxn3 = 1e3 + 10;
const long long int Maxn4 = 1e4 + 10;
const long long int Maxn5 = 1e5 + 10;
const long long int Maxn6 = 1e6 + 10;
const long long int Maxn7 = 1e7 + 10;
const long long int Maxn8 = 1e8 + 10;
const long long int Maxn9 = 1e9 + 10;
const long long int Maxn18 = 1e18 + 10;
const long long int Mod1 = 1e7 + 7;
const long long int Mod2 = 1e9 + 7;
const long long int LLMax = LLONG_MAX;
const long long int LLMin = LLONG_MIN;
const long long int INTMax = INT_MAX;
const long long int INTMin = INT_MIN;
long long int mn = LLMax, mx = LLMin;
vector<long long int> g[3 * Maxn5];
long long int f[3 * Maxn5][32], w[3 * Maxn5], a[3 * Maxn5], m, n;
void dfs(long long int x, long long int p) {
  w[x] = 1;
  for (long long int y : g[x])
    if (y != p) dfs(y, x), ((w[x]) = max((w[x]), (1 + w[y])));
  f[x][1] = n;
  for (long long int i = 2; i < 21; i++) {
    long long int m = 0;
    for (long long int y : g[x])
      if (y != p) a[m++] = f[y][i - 1];
    sort(a, a + m);
    reverse(a, a + m);
    f[x][i] = 0;
    while (f[x][i] < m and a[f[x][i]] > f[x][i]) f[x][i]++;
    ((f[x][i]) = max((f[x][i]), (1ll)));
  }
  f[x][21] = 1;
}
void dfs2(long long int x, long long int p) {
  for (long long int y : g[x])
    if (y != p) {
      dfs2(y, x);
      for (long long int i = 1; i < 21; i++)
        ((f[x][i]) = max((f[x][i]), (f[y][i])));
    }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  scanf("%lld", &n);
  for (long long int i = 1; i < n; i++) {
    long long int u, v;
    scanf("%lld %lld", &u, &v);
    u--;
    v--;
    g[u].push_back(v), g[v].push_back(u);
  }
  dfs(0ll, -1ll);
  dfs2(0ll, -1ll);
  long long int res = 0;
  for (long long int i = 0; i < n; i++) {
    res += w[i];
    for (long long int j = 1; j < 21; j++) res += j * (f[i][j] - f[i][j + 1]);
  }
  return cout << res, 0;
}
