#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 100;
vector<int> G[N];
int dp[N][75];
int sub[N][75];
int dp1[N], dp2[N];
int M, n;
long long ans;
void dfs(int u, int p) {
  int child = 0;
  vector<int> ch_sz;
  for (int v : G[u]) {
    if (v == p) continue;
    dfs(v, u);
    for (int k = 1; k < M; k++) {
      sub[u][k] = max(sub[u][k], sub[v][k]);
    }
    dp1[u] = max(dp1[u], dp1[v]);
    dp2[u] = max(dp2[u], dp2[v]);
    child++;
    ch_sz.push_back(G[v].size() - 1);
  }
  sort(ch_sz.rbegin(), ch_sz.rend());
  for (int k = 1; k <= min(child, M - 1); k++) {
    vector<int> opts;
    for (int v : G[u]) {
      if (v == p) continue;
      opts.push_back(-dp[v][k]);
    }
    nth_element(opts.begin(), opts.begin() + k - 1, opts.end());
    dp[u][k] = max(dp[u][k], -opts[k - 1] + 1);
  }
  for (int k = 1; k < M; k++) {
    sub[u][k] = max(sub[u][k], dp[u][k]);
    ans += sub[u][k] + 1;
  }
  if (ch_sz.size() > 0 && ch_sz[0] > 0) {
    int lo = 1, hi = ch_sz.size();
    while (hi > lo) {
      int mid = (hi + lo + 1) / 2;
      if (ch_sz[mid - 1] >= mid)
        lo = mid;
      else
        hi = mid - 1;
    }
    dp1[u] = max(dp1[u], lo);
  }
  dp2[u] = max(dp2[u], (int)ch_sz.size());
  ans += (n - M + 1);
  if (dp1[u] >= M) ans += (dp1[u] - M + 1);
  if (dp2[u] >= M) ans += (dp2[u] - M + 1);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  M = min(70, n + 1);
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(1, -1);
  cout << ans << endl;
  return 0;
}
