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;
const int inf = 1e9;
const long long inf_ll = 1e18;
const int N = 3e5 + 5;
long long d[N], pt[N], ans, sum;
vector<long long> adj[N], dp[N], s;
multiset<long long> f[N];
void dfs1(int i, int p) {
  pt[i] = d[i] = adj[i].size() - (i != 0);
  dp[i].resize(d[i]);
  for (auto& j : adj[i])
    if (j != p) {
      dfs1(j, i);
      for (int k = 0; k < min(d[i], d[j]); k++) dp[i][k]++;
      pt[i] += pt[j];
    }
  for (long long k = 0; k < d[i]; k++) {
    if (dp[i][k] <= k)
      dp[i][k] = 1;
    else {
      s.clear();
      for (auto& j : adj[i])
        if (j != p && d[j] > k) s.push_back(dp[j][k]);
      nth_element(s.begin(), s.end() - 1 - k, s.end());
      ;
      dp[i][k] = s[s.size() - 1 - k] + 1;
    }
  };
}
void ins(int i, int p) {
  for (int j = 0; j < d[i]; j++) {
    long long pre = f[j].empty() ? 0 : *--f[j].end();
    f[j].insert(dp[i][j]);
    sum += *--f[j].end() - pre;
  }
  for (auto& j : adj[i])
    if (j != p) ins(j, i);
}
void rem(int i, int p) {
  for (int j = 0; j < d[i]; j++) {
    long long pre = *--f[j].end();
    f[j].erase(f[j].find(dp[i][j]));
    sum += (f[j].empty() ? 0 : *--f[j].end()) - pre;
  }
  for (auto& j : adj[i])
    if (j != p) rem(j, i);
}
void dfs2(int i, int p) {
  int k = -1;
  for (auto& j : adj[i])
    if (j != p && (k == -1 || pt[j] > pt[k])) k = j;
  for (auto& j : adj[i])
    if (j != p && j != k) dfs2(j, i), rem(j, i);
  if (k != -1) dfs2(k, i);
  for (auto& j : adj[i])
    if (j != p && j != k) ins(j, i);
  for (int j = 0; j < d[i]; j++) {
    long long pre = f[j].empty() ? 0 : *--f[j].end();
    f[j].insert(dp[i][j]);
    sum += *--f[j].end() - pre;
  };
  ans += sum;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    adj[u].push_back(v), adj[v].push_back(u);
  }
  dfs1(0, 0);
  dfs2(0, 0);
  cout << ans + n * n << "\n";
}
