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;
inline void setmin(int &x, int y) {
  if (y < x) x = y;
}
inline void setmax(int &x, int y) {
  if (y > x) x = y;
}
inline void setmin(long long &x, long long y) {
  if (y < x) x = y;
}
inline void setmax(long long &x, long long y) {
  if (y > x) x = y;
}
const int N = 300000;
const int inf = (int)1e9 + 1;
const long long big = (long long)1e18 + 1;
const int P = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;
int n;
vector<int> g[N];
int depth[N];
int dp[N][19];
int dp1[N][19];
long long ans = 0;
void dfs(int u, int par) {
  depth[u] = 1;
  for (int v : g[u])
    if (v != par) {
      dfs(v, u);
      setmax(depth[u], depth[v] + 1);
    }
  dp[u][0] = n;
  for (int b = 1; b < 19; b++) {
    dp[u][b] = 1;
    vector<int> vals;
    for (int v : g[u])
      if (v != par) vals.push_back(dp[v][b - 1]);
    sort(vals.begin(), vals.end());
    reverse(vals.begin(), vals.end());
    for (int i = 0; i < (int)vals.size(); i++)
      setmax(dp[u][b], min(i + 1, vals[i]));
  }
  for (int b = 0; b < 19; b++) {
    dp1[u][b] = dp[u][b];
    for (int v : g[u])
      if (v != par) setmax(dp1[u][b], dp1[v][b]);
  }
  for (int b = 0; b < 19; b++)
    ans += (b + 1) * (dp1[u][b] - (b + 1 < 19 ? dp1[u][b + 1] : 1));
  ans += depth[u];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  cout << fixed;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0, -1);
  cout << ans << "\n";
  return 0;
}
