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 N = 3e5 + 5;
int n;
vector<int> adj[N];
int h[N];
int f[N][20], g[N][20];
void dfs(int u, int p) {
  for (int v : adj[u])
    if (v != p) {
      dfs(v, u);
      h[u] = max(h[u], h[v] + 1);
    }
  f[u][1] = g[u][1] = n;
  for (int i = 2; i <= 19; ++i) {
    int l = 0, r = n;
    while (l < r) {
      int mid = (l + r + 1) >> 1;
      int cnt = 0;
      for (int v : adj[u])
        if (v != p) {
          if (g[v][i - 1] >= mid) cnt++;
        }
      if (cnt >= mid)
        l = mid;
      else
        r = mid - 1;
    }
    g[u][i] = l;
    for (int v : adj[u])
      if (v != p) {
        f[u][i] = max(f[u][i], f[v][i]);
      }
    f[u][i] = max(f[u][i], g[u][i]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v), adj[v].push_back(u);
  }
  dfs(1, 1);
  long long res = 0;
  for (int u = 1; u <= n; ++u) res += h[u];
  for (int u = 1; u <= n; ++u) {
    for (int i = 1; i <= 19; ++i) {
      int l = 2;
      if (i < 19) l = max(l, f[u][i + 1] + 1);
      int r = f[u][i];
      if (l <= r) res += 1LL * (r - l + 1) * (i - 1);
    }
  }
  res += 1LL * n * n;
  cout << res << '\n';
}
