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;
int n;
const int MaxN = 3e5;
vector<int> adj[MaxN];
vector<int> prec[MaxN];
void dfs(const int u, const int p) {
  prec[u] = {1, n};
  adj[u].erase(remove(adj[u].begin(), adj[u].end(), p), adj[u].end());
  for (auto &&v : adj[u]) {
    dfs(v, u);
    prec[u][0] = max(prec[u][0], 1 + prec[v][0]);
  }
  for (int i = 2;; ++i) {
    int lo = 1;
    int hi = adj[u].size();
    while (lo < hi) {
      int mid = (lo + hi + 1) >> 1;
      int count = 0;
      for (auto &&v : adj[u])
        count += i <= prec[v].size() && prec[v][i - 1] >= mid;
      if (count >= mid)
        lo = mid;
      else
        hi = mid - 1;
    }
    if (lo <= 1) break;
    prec[u].push_back(lo);
  }
}
void dfs2(const int u, long long &ans) {
  for (auto &&v : adj[u]) {
    dfs2(v, ans);
    if (prec[u].size() < prec[v].size()) prec[u].resize(prec[v].size(), 0);
    for (int i = 2; i < prec[v].size(); ++i)
      prec[u][i] = max(prec[u][i], prec[v][i]);
  }
  ans -= prec[u].size() - 1;
  for (auto &&x : prec[u]) ans += x;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(0, -1);
  long long ans = 0;
  dfs2(0, ans);
  cout << ans;
  return 0;
}
