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, bzmax = 20;
int n;
int h[N];
int f[N][bzmax];
int buf[N], par[N];
vector<pair<int, int> > upd[N];
vector<int> g[N];
long long res;
int dres;
inline void init() {
  scanf("%d", &n);
  for (int i = 1, u, v; i < n; i++) {
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
}
int dp(int p, int fa) {
  int rt = 0;
  par[p] = fa;
  for (int i = 0; i < (signed)g[p].size(); i++) {
    int e = g[p][i];
    if (e ^ fa) rt = max(rt, dp(e, p));
  }
  f[p][1] = n;
  for (int t = 2; t < bzmax; t++) {
    int tp = 0;
    for (int i = 0; i < (signed)g[p].size(); i++) {
      int e = g[p][i];
      if ((e ^ fa) && f[e][t - 1]) buf[++tp] = f[e][t - 1];
    }
    sort(buf + 1, buf + tp + 1, greater<int>());
    for (int i = tp; i && !f[p][t]; i--)
      if (buf[i] >= i) f[p][t] = i;
    if (f[p][t] > 1) upd[f[p][t]].push_back(pair<int, int>(p, t));
  }
  res += rt + 1;
  return rt + 1;
}
void update(int p, int v) {
  while (p) {
    if (v <= h[p]) break;
    dres += v - h[p];
    h[p] = v, p = par[p];
  }
}
inline void solve() {
  dp(1, 0);
  dres = n;
  for (int i = 1; i <= n; i++) h[i] = 1;
  for (int k = n; k > 1; k--) {
    for (int i = 0; i < (signed)upd[k].size(); i++)
      update(upd[k][i].first, upd[k][i].second);
    res += dres;
  }
  printf("%lld", res);
}
int main() {
  init();
  solve();
  return 0;
}
