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;
vector<vector<pair<int, int> > > vec(323456);
vector<vector<int> > adj(312345);
int lev[312345], maxdepth[312345];
long long bigg = 0;
int jaja[312345][19];
vector<int> wow;
int n;
int dfs(int cur, int par) {
  int i;
  lev[cur] = 1;
  maxdepth[cur] = 0;
  for (i = 0; i < adj[cur].size(); i++) {
    if (adj[cur][i] != par) {
      dfs(adj[cur][i], cur);
      lev[cur] = max(lev[adj[cur][i]] + 1, lev[cur]);
      maxdepth[cur] = max(maxdepth[adj[cur][i]], maxdepth[cur]);
    }
  }
  int depth = 2;
  int previ = n, u, val;
  long long j;
  int ans, low, mid, high;
  vec[cur].push_back(make_pair(1, n));
  jaja[cur][1] = n;
  vector<pair<int, int> >::iterator it;
  int iter = 0;
  while (1) {
    wow.clear();
    for (j = 0; j < adj[cur].size(); j++) {
      u = adj[cur][j];
      if (u == par) continue;
      it = upper_bound(vec[u].begin(), vec[u].end(), make_pair(depth - 1, -1));
      if (it == vec[u].end()) continue;
      wow.push_back(it->second);
    }
    sort(wow.begin(), wow.end());
    int low = 2;
    int high = n - 1;
    ans = -1;
    while (low <= high) {
      mid = (low + high) / 2;
      val = wow.end() - lower_bound(wow.begin(), wow.end(), mid);
      if (val >= mid) {
        ans = mid;
        low = mid + 1;
      } else {
        high = mid - 1;
      }
    }
    if (ans == -1) {
      maxdepth[cur] = max(depth - 1, maxdepth[cur]);
      break;
    }
    jaja[cur][depth] = ans;
    vec[cur].push_back(make_pair(depth, ans));
    previ = ans;
    depth++;
  }
  val = maxdepth[cur] + 1;
  for (i = 0; i < adj[cur].size(); i++) {
    u = adj[cur][i];
    if (u == par) continue;
    for (j = 1; j < val; j++) {
      jaja[cur][j] = max(jaja[cur][j], jaja[u][j]);
    }
  }
  for (j = 1; j < val - 1; j++) {
    bigg += j * (jaja[cur][j] - jaja[cur][j + 1]);
  }
  j = val - 1;
  bigg += j * (jaja[cur][j] - 1);
  return 0;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n;
  int i, u, v;
  for (i = 0; i < n - 1; i++) {
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(0, -1);
  for (i = 0; i < n; i++) {
    bigg += lev[i];
  }
  cout << bigg << endl;
  return 0;
}
