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;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int &x, int y, int mod = 1000000007) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et() {
  puts("-1");
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 1000000007) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) {
  long long z = y;
  while (x % y != 0) {
    z = x % y;
    x = y;
    y = z;
  }
  return z;
}
vector<int> mp[300105];
int d[300105], pa[300105], f[300105][20], dp[300105];
int a[300105], cnt;
long long ans;
vector<pair<int, int> > vp[300105];
bool cmp(int x, int y) { return y < x; }
void dfs(int x) {
  d[x] = 1;
  f[x][1] = n;
  for (int c : mp[x])
    if (c != pa[x]) {
      pa[c] = x;
      dfs(c);
      d[x] = max(d[x], d[c] + 1);
    }
  ans += d[x];
  for (int i = 2; i < 20; i++) {
    cnt = 0;
    for (int c : mp[x])
      if (c != pa[x]) {
        a[++cnt] = f[c][i - 1];
      }
    if (cnt == 0) break;
    sort(a + 1, a + 1 + cnt, cmp);
    k = 0;
    while (k < cnt && a[k + 1] >= k + 1) {
      k++;
    }
    f[x][i] = k;
    vp[k].push_back({x, i});
  }
}
void fmain(int ID) {
  scanf("%d", &n);
  for (int i = 0, u, v; i < n - 1; i++) {
    scanf("%d%d", &u, &v);
    mp[u].push_back(v);
    mp[v].push_back(u);
  };
  dfs(1);
  for (int(i) = 1; (i) <= (int)(n); (i)++) dp[i] = 1;
  long long ss = n;
  for (int k = n; k > 1; k--) {
    for (auto p : vp[k]) {
      int x = p.first;
      int j = p.second;
      while (x && dp[x] < j) {
        ss += j - dp[x];
        dp[x] = j;
        x = pa[x];
      }
    }
    ans += ss;
  }
  printf("%lld\n", ans);
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
