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>
std::vector<int> edges[300000];
int parent[300000];
int dp[300000];
int64_t sum = 0;
int subtree[300000];
void dfs_parent(int node, int par) {
  parent[node] = par;
  dp[node] = 1;
  subtree[node] = 1;
  for (int child : edges[node]) {
    if (child == par) continue;
    dfs_parent(child, node);
    dp[node] = std::max(dp[node], dp[child] + 1);
    subtree[node] = std::max(subtree[node], subtree[child]);
  }
  subtree[node] = std::max(subtree[node], dp[node]);
  sum += subtree[node];
}
std::vector<std::array<int, 30> > children;
std::list<int> buckets[300000];
std::list<int>::iterator nums[300000];
int critical[300000];
std::vector<std::pair<int, int> > shifts[300001];
void dfs_heap(int node) {
  dp[node] = 1;
  subtree[node] = 1;
  std::vector<int> best;
  for (int child : edges[node]) {
    if (child != parent[node]) {
      dfs_heap(child);
      best.push_back(dp[child]);
      children[node][dp[child]]++;
      subtree[node] = std::max(subtree[node], subtree[child]);
    }
  }
  std::sort(best.begin(), best.end());
  std::reverse(best.begin(), best.end());
  if (best.size() >= 2) {
    dp[node] = std::max(dp[node], best[1] + 1);
  }
  for (int c : best) {
    critical[node] += (c >= (dp[node] - 1));
  }
  nums[node] =
      buckets[critical[node]].insert(buckets[critical[node]].begin(), node);
  subtree[node] = std::max(subtree[node], dp[node]);
  sum += subtree[node];
}
void set_critical(int node, int val) {
  buckets[critical[node]].erase(nums[node]);
  critical[node] = val;
  nums[node] = buckets[val].insert(buckets[val].begin(), node);
}
int64_t total = 0;
int main() {
  int N;
  scanf("%d", &N);
  children.resize(N);
  for (int i = 0; i < N - 1; i++) {
    int U, V;
    scanf("%d %d", &U, &V);
    U--, V--;
    edges[U].push_back(V);
    edges[V].push_back(U);
  }
  sum = 0;
  dfs_parent(0, -1);
  total += sum;
  sum = 0;
  dfs_heap(0);
  total += sum;
  for (int i = 0; i < N; i++) {
    edges[i].clear();
  }
  for (int k = 3; k <= N; k++) {
    std::queue<int> change;
    for (int node : buckets[k - 1]) {
      change.push(node);
    }
    while (!change.empty()) {
      int node = change.front();
      change.pop();
      if (critical[node] >= k || dp[node] == 1) continue;
      if (parent[node] >= 0) {
        children[parent[node]][dp[node]]--;
        if (dp[node] >= dp[parent[node]] - 1) {
          set_critical(parent[node], critical[parent[node]] - 1);
        }
      }
      shifts[k].emplace_back(node, dp[node]);
      dp[node]--;
      set_critical(node, critical[node] + children[node][dp[node] - 1]);
      if (parent[node] >= 0) {
        children[parent[node]][dp[node]]++;
        if (dp[node] >= dp[parent[node]] - 1) {
          set_critical(parent[node], critical[parent[node]] + 1);
        }
      }
      change.push(node);
      if (parent[node] >= 0) {
        change.push(parent[node]);
      }
    }
  }
  sum = N;
  for (int i = 0; i < N; i++) {
    buckets[i].clear();
  }
  children.clear();
  for (int k = N; k > 2; k--) {
    total += sum;
    std::queue<std::pair<int, int> > events;
    std::reverse(shifts[k].begin(), shifts[k].end());
    for (std::pair<int, int> s : shifts[k]) {
      events.push(s);
    }
    while (!events.empty()) {
      int node = events.front().first;
      int set = events.front().second;
      events.pop();
      if (dp[node] < set) {
        sum -= dp[node];
        dp[node] = set;
        sum += dp[node];
        if (parent[node] >= 0) {
          events.emplace(parent[node], set);
        }
      }
    }
  }
  printf("%I64d\n", total);
  return 0;
}
