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;
long long int gcd(long long int a, long long int b) {
  return (b == 0LL ? a : gcd(b, a % b));
}
long double dist(long double x, long double arayikhalatyan, long double x2,
                 long double y2) {
  return sqrt((x - x2) * (x - x2) +
              (arayikhalatyan - y2) * (arayikhalatyan - y2));
}
long long int S(long long int a) { return (a * (a - 1LL)) / 2; }
mt19937 rnd(363542);
char vow[] = {'a', 'e', 'i', 'o', 'u'};
int dx[] = {0, -1, 0, 1, -1, -1, 1, 1, 0};
int dy[] = {-1, 0, 1, 0, -1, 1, -1, 1, 0};
const int N = 3e5 + 30;
const long long int mod = 1e15 + 7;
const long double pi = acos(-1);
const int T = 550;
long long int bp(long long int a, long long int b = mod - 2LL) {
  long long int ret = 1;
  while (b) {
    if (b & 1) ret *= a, ret %= mod;
    a *= a;
    a %= mod;
    b >>= 1;
  }
  return ret;
}
ostream& operator<<(ostream& c, pair<int, int> a) {
  c << a.first << " " << a.second;
  return c;
}
void maxi(long long int& a, long long int b) { a = max(a, b); }
int n;
vector<int> g[N];
int a[N][101], b[N][101];
long long int pat;
long long int dfs(int v, int par) {
  long long int mx = 0, qn = 0;
  for (auto p : g[v]) {
    if (p == par) continue;
    qn++;
    mx = max(mx, dfs(p, v));
    for (int i = 1; i <= min(n, 70); i++) b[v][i] = max(b[v][i], b[p][i]);
  }
  mx = max(mx, qn);
  if (n >= 71) {
    if (mx >= 71)
      pat += 2LL * (mx - 70) + n - mx;
    else
      pat += (long long int)(n - 70);
  }
  for (int i = 1; i <= min(n, 70); i++) {
    if (qn < i) {
      a[v][i] = 1;
      b[v][i] = max(b[v][i], a[v][i]);
      pat += b[v][i];
      continue;
    }
    vector<int> fp;
    for (auto p : g[v]) {
      if (p == par) continue;
      fp.push_back(-a[p][i]);
    }
    nth_element(fp.begin(), fp.begin() + i - 1, fp.end());
    a[v][i] = -fp[i - 1] + 1;
    b[v][i] = max(b[v][i], a[v][i]);
    pat += b[v][i];
  }
  return mx;
}
long long int dfs1(int v, int par) {
  long long int mx = 0;
  vector<int> fp;
  for (auto p : g[v]) {
    if (p == par) continue;
    mx = max(mx, dfs1(p, v));
    fp.push_back(g[p].size() - 1);
  }
  sort((fp).begin(), (fp).end());
  reverse((fp).begin(), (fp).end());
  bool bl = 0;
  for (int i = 0; i < fp.size(); i++) {
    if (fp[i] < i + 1) {
      bl = 1;
      mx = max(mx, (long long int)i);
      break;
    }
  }
  if (!bl) mx = max(mx, (long long int)fp.size());
  pat += max(0LL, mx - 70);
  return mx;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(1, 1);
  dfs1(1, 1);
  cout << pat << endl;
  return 0;
}
