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 = 300005;
long long n, dp[N][20][2], ans, h[N];
vector<vector<long long> > gr;
priority_queue<long long> pq[N][20];
void dfs(long long u, long long par) {
  dp[u][1][0] = dp[u][1][1] = n;
  for (long long i = 0; i < gr[u].size(); ++i) {
    long long v = gr[u][i];
    if (v != par) {
      dfs(v, u);
      h[u] = max(h[u], h[v] + 1);
      for (long long j = 2; j <= 18; ++j) {
        pq[u][j].push(dp[v][j - 1][0]);
        dp[u][j][1] = max(dp[v][j][1], dp[u][j][1]);
      }
    }
  }
  vector<long long> x[20];
  for (long long i = 2; i <= 18; ++i) {
    while (!pq[u][i].empty()) {
      x[i].push_back(pq[u][i].top());
      pq[u][i].pop();
    }
  }
  for (long long i = 2; i <= 18; ++i) {
    if (x[i].size()) {
      for (long long j = x[i].size() - 1; j >= 0; --j) {
        if (x[i][j] >= j + 1) {
          dp[u][i][0] = max(j + 1, dp[u][i][0]);
          break;
        }
      }
      dp[u][i][1] = max(dp[u][i][1], dp[u][i][0]);
    }
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  gr.resize(n + 5, vector<long long>());
  for (long long i = 0; i < n - 1; ++i) {
    long long u, v;
    cin >> u >> v;
    gr[u].push_back(v);
    gr[v].push_back(u);
  }
  dfs(1, 0);
  for (long long i = 1; i <= n; ++i) ans += h[i];
  ans += n * n;
  for (long long u = 1; u <= n; ++u) {
    for (long long i = 1; i <= 19; ++i) {
      long long l = 2;
      if (i <= 18) l = max(l, dp[u][i + 1][1] + 1);
      long long r = dp[u][i][1];
      if (l <= r) ans += (r - l + 1) * (i - 1);
    }
  }
  cout << ans;
  return 0;
}
