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 B = 550;
const int N = B * B;
const int C = 24;
const int D = 4;
int dp[N];
int max_depth[N];
int n;
vector<int> edges[N];
void dfs(int v, int par, int k) {
  vector<int> pool;
  int ma = 1;
  for (int i = (int)(0); i < (int)(edges[v].size()); i++) {
    int w = edges[v][i];
    if (par == w) continue;
    dfs(w, v, k);
    pool.push_back(max_depth[w]);
    ma = max(ma, dp[w]);
  }
  max_depth[v] = 1;
  if ((int)pool.size() >= k) {
    nth_element(pool.begin(), pool.end() - k, pool.end());
    max_depth[v] = pool[pool.size() - k] + 1;
    ma = max(ma, max_depth[v]);
  }
  dp[v] = ma;
}
int dp_dep[D + 1][N];
int dp_dep_direct[D + 1][N];
int dfs_dep(int v, int par, int dep) {
  int ma = 0;
  vector<int> pool;
  for (int i = (int)(0); i < (int)(edges[v].size()); i++) {
    int w = edges[v][i];
    if (par == w) continue;
    int val = dfs_dep(w, v, dep);
    pool.push_back(dp_dep_direct[dep - 1][w]);
    ma = max(ma, val);
  }
  int ma_dir = 0;
  sort(pool.rbegin(), pool.rend());
  for (int i = (int)(0); i < (int)(pool.size()); i++) {
    if (pool[i] >= i + 1) {
      ma_dir = max(ma_dir, i + 1);
    }
  }
  dp_dep_direct[dep][v] = ma_dir;
  return dp_dep[dep][v] = max(ma, ma_dir);
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = (int)(0); i < (int)(n - 1); i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    edges[u].push_back(v);
    edges[v].push_back(u);
  }
  long long int tot = 0;
  for (int k = (int)(1); k < (int)(C + 1); k++) {
    if (k <= n) {
      dfs(0, -1, k);
      for (int i = (int)(0); i < (int)(n); i++) {
        tot += dp[i];
      }
    }
  }
  if (n > C) {
    for (int i = (int)(0); i < (int)(n); i++) {
      dp_dep[1][i] = n;
      dp_dep_direct[1][i] = n;
    }
    for (int b = (int)(2); b < (int)(D + 1); b++) {
      dfs_dep(0, -1, b);
    }
    for (int i = (int)(0); i < (int)(n); i++) {
      if (0) {
        cerr << "i"
             << "=" << i << "\n";
        for (int b = (int)(2); b < (int)(D + 1); b++) {
          cerr << "b"
               << "=" << b << "\n";
          cerr << "dp_dep[b][i]"
               << "=" << dp_dep[b][i] << "\n";
          cerr << "dp_dep_direct[b][i]"
               << "=" << dp_dep_direct[b][i] << "\n";
        }
      }
      tot += n - C;
      for (int b = (int)(2); b < (int)(D + 1); b++) {
        tot += max(dp_dep[b][i], C) - C;
      }
    }
  }
  cout << tot << endl;
}
