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 n;
vector<vector<int> > child(300001, vector<int>());
bool was[300001];
int DP3till[300001];
int DP2till[300001];
int k2[300001];
long long int toadd;
pair<int, int> dfs(int v, int k) {
  multiset<int> ways;
  int cn1 = 0;
  int mx = 0;
  for (int u : child[v]) {
    auto curr = dfs(u, k);
    mx = max(mx, curr.second);
    if (curr.first != 1) {
      ways.insert(curr.first);
    } else {
      cn1++;
    }
  }
  int curr = 1;
  if (child[v].size() >= k) {
    curr = 2;
  }
  if (((int)ways.size()) >= k) {
    auto it = ways.end();
    for (int i = 0; i < k; i++) {
      it--;
    }
    curr = *it + 1;
  }
  toadd += max(curr, mx);
  return {curr, max(curr, mx)};
}
void dfs2(int v) {
  DP2till[v] = k2[v] = child[v].size();
  vector<int> till3;
  for (int u : child[v]) {
    dfs2(u);
    till3.push_back(k2[u]);
    DP2till[v] = max(DP2till[v], DP2till[u]);
    DP3till[v] = max(DP3till[v], DP3till[u]);
  }
  if (child[v].size() >= 70) {
    sort(till3.begin(), till3.end(), greater<int>());
    int left = 70;
    int right = till3.size();
    while (left < right) {
      int mid = (left + right) / 2;
      if (left == right - 1) {
        mid++;
      }
      if (till3[mid - 1] >= mid) {
        left = mid;
      } else {
        right = mid - 1;
      }
    }
    if (till3[left - 1] >= left) {
      DP3till[v] = max(DP3till[v], left);
    }
  }
}
int main() {
  scanf("%d", &n);
  vector<vector<int> > graph(n + 1, vector<int>());
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  stack<int> st;
  st.push(1);
  was[1] = true;
  while (!st.empty()) {
    int v = st.top();
    st.pop();
    for (int u : graph[v]) {
      if (!was[u]) {
        child[v].push_back(u);
        st.push(u);
        was[u] = true;
      }
    }
  }
  long long int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i == 70) {
      dfs2(1);
      ans += (n - i + 1) * n;
      for (int v = 1; v <= n; v++) {
        if (DP2till[v] >= 70) {
          ans += DP2till[v] - 70 + 1;
        }
        if (DP3till[v] >= 70) {
          ans += DP3till[v] - 70 + 1;
        }
      }
      break;
    }
    toadd = 0;
    dfs(1, i);
    ans += toadd;
  }
  printf("%lld", ans);
  return 0;
}
