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 int logn = 20;
int n;
vector<vector<int> > g, dp;
vector<int> f, maxd;
void dfs1(int v = 0, int p = -1) {
  for (int i : g[v]) {
    if (i != p) {
      dfs1(i, v);
      maxd[v] = max(maxd[i] + 1, maxd[v]);
    }
  }
  dp[v][0] = n;
  for (int l = 1; l < logn; l++) {
    for (int i : g[v]) f[min((int)g[v].size(), dp[i][l - 1])]++;
    int j = g[v].size(), cnt = 0;
    for (int i = 1; i <= g[v].size(); i++) {
      while (cnt < i) cnt += f[j--];
      if (j + 1 >= i) dp[v][l] = i;
    }
    for (int i : g[v]) f[min((int)g[v].size(), dp[i][l - 1])]--;
  }
  for (int l = logn - 1; l > 1; l--) dp[v][l - 1] = max(dp[v][l - 1], dp[v][l]);
}
void dfs2(int v = 0, int p = -1) {
  for (int i : g[v]) {
    if (i != p) {
      dfs2(i, v);
      for (int l = 1; l < logn; l++) dp[v][l] = max(dp[v][l], dp[i][l]);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  g.resize(n);
  maxd.resize(n, 1);
  f.resize(n + 1, 0);
  dp.resize(n, vector<int>(logn, 0));
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    g[--u].push_back(--v);
    g[v].push_back(u);
  }
  dfs1();
  dfs2();
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += maxd[i];
    for (long long l = 0; l < logn; l++) ans += max(0ll, dp[i][l] - 1ll);
  }
  cout << ans << "\n";
  return 0;
}
