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;
template <class _Tp>
_Tp gcd(_Tp a, _Tp b) {
  return (b == 0) ? (a) : (gcd(b, a % b));
}
const long long Inf = 1000000000000000000ll;
const int inf = 1000000000;
char buf[1 << 25], *p1 = buf, *p2 = buf;
inline int getc() {
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 25, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read() {
  int x = 0, f = 0;
  char c = getc();
  while (!isdigit(c)) (c == '-') && (f = 1), c = getc();
  while (isdigit(c)) x = x * 10 + (c & 15), c = getc();
  return f ? -x : x;
}
const int Lg = 19;
const int N = 300005;
vector<int> e[N];
vector<pair<int, int> > upt[N];
int fa[N], a[N], dp[N][Lg], n;
long long ans, delta;
int getone(int u, int f) {
  int res = 0;
  fa[u] = f;
  for (int i = 0; i < e[u].size(); ++i) {
    if (e[u][i] == f) continue;
    res = max(res, getone(e[u][i], u));
  }
  ans += res + 1;
  return res + 1;
}
void dfs(int u) {
  for (int i = 0; i < e[u].size(); ++i) {
    if (e[u][i] == fa[u]) continue;
    dfs(e[u][i]);
  }
  dp[u][1] = n;
  for (int t = 2; t < Lg; ++t) {
    int tot = 0;
    for (int i = 0; i < e[u].size(); ++i) {
      int to = e[u][i];
      if (to == fa[u]) continue;
      if (dp[to][t - 1]) a[++tot] = dp[to][t - 1];
    }
    sort(a + 1, a + tot + 1, greater<int>());
    for (int i = tot; i >= 1 && !dp[u][t]; --i)
      if (a[i] >= i) dp[u][t] = i;
    if (dp[u][t] > 1) upt[dp[u][t]].push_back(make_pair(u, t));
  }
}
void update(int u, int w) {
  while (u) {
    if (w <= a[u]) break;
    delta += w - a[u];
    a[u] = w;
    u = fa[u];
  }
}
int main() {
  n = read();
  for (int i = 1; i < n; ++i) {
    int x = read(), y = read();
    e[x].push_back(y);
    e[y].push_back(x);
  }
  getone(1, 0);
  dfs(1);
  delta = n;
  for (int i = 1; i <= n; ++i) a[i] = 1;
  for (int k = n; k > 1; --k) {
    for (int i = 0; i < upt[k].size(); ++i)
      update(upt[k][i].first, upt[k][i].second);
    ans += delta;
  }
  printf("%lld\n", ans);
  return 0;
}
