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 N = 3e5 + 2;
const long long inf = 1e9 + 7;
long long dp[N][22], f[N], max1[N][22];
long long ans = 0;
vector<long long> adj[N];
void dfs(long long x, long long p) {
  vector<long long> temp[22];
  long long i, j, lef, rig, mid;
  for (i = 0; i < adj[x].size(); i++) {
    if (adj[x][i] != p) {
      dfs(adj[x][i], x);
      f[x] = max(f[x], f[adj[x][i]] + 1);
      for (j = 1; j <= 20; j++) {
        if (dp[adj[x][i]][j - 1] != 0) {
          temp[j].push_back(dp[adj[x][i]][j - 1]);
        }
        max1[x][j] = max(max1[x][j], max1[adj[x][i]][j]);
      }
      dp[x][1]++;
    }
  }
  for (i = 2; i <= 20; i++) {
    sort(temp[i].begin(), temp[i].end(),
         [&](long long x, long long y) { return x > y; });
    rig = temp[i].size();
    lef = 1;
    while (rig > lef) {
      mid = (lef + rig + 1) / 2;
      if (temp[i][mid - 1] >= mid) {
        lef = mid;
      } else {
        rig = mid - 1;
      }
    }
    dp[x][i] = rig;
  }
  for (i = 1; i <= 20; i++) {
    max1[x][i] = max(max1[x][i], dp[x][i]);
  }
  for (i = 1; i <= 20; i++) {
    j = 2;
    if (i != 20) {
      j = max(j, max1[x][i + 1] + 1);
    }
    if (max1[x][i] >= j) {
      ans += (max1[x][i] - j + 1) * i;
    }
  }
  ans += f[x];
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, i, j, k, l;
  cin >> n;
  for (i = 1; i < n; i++) {
    cin >> j >> k;
    adj[j].push_back(k);
    adj[k].push_back(j);
  }
  dfs(1, 1);
  cout << ans + n * n;
}
