#include <bits/stdc++.h>
using namespace std;
int const M = 3e5 + 100, inf = 1e9 + 20, mod = 1e9 + 7;
int n, a[M], dp[M], st[M], fin[M], mark[M];
vector<pair<int, int> > cand;
vector<int> ve;
vector<int> adj[M];
vector<pair<int, int> > good;
int par[M][30];
long long ans;
vector<int> hist;
bool seg[M * 4];
int pw(int x, int y) {
  if (y == 0) return 1;
  int tmp = pw(x, y / 2);
  if (y % 2 == 0) return (tmp * tmp) % mod;
  return ((tmp * tmp) % mod * x) % mod;
}
void dfs_lca(int v, int l) {
  par[v][0] = l;
  ve.push_back(v);
  st[v] = (int)ve.size() - 1;
  for (int i = 1; i <= 20; i++) par[v][i] = par[par[v][i - 1]][i - 1];
  for (int i = 0; i < adj[v].size(); i++) {
    int u = adj[v][i];
    if (u != l) dfs_lca(u, v);
  }
  fin[v] = (int)ve.size();
}
bool ch(int x, int v, int ind, int base) {
  int cn = 0;
  for (int i = 0; i <= ind; i++) {
    int u = adj[v][i];
    if (u == par[v][0]) continue;
    if (dp[u] >= x) cn++;
  }
  if (cn >= base) return 1;
  return 0;
}
void dfs(int v, int base) {
  mark[v] = base;
  dp[v] = 1;
  int cn = 0, mx = 0, ind;
  for (int i = 0; i < adj[v].size(); i++) {
    int u = adj[v][i];
    if ((int)adj[u].size() - 1 < base) break;
    if (u == par[v][0]) continue;
    if (mark[u] != base) dfs(u, base);
    cn++;
    mx = max(mx, dp[u]);
    ind = i;
  }
  if (cn >= base) {
    int lo = 0, hi = mx;
    while (hi > lo + 1) {
      int mid = (lo + hi) / 2;
      if (ch(mid, v, ind, base))
        lo = mid;
      else
        hi = mid - 1;
    }
    if (ch(hi, v, ind, base))
      dp[v] = hi + 1;
    else
      dp[v] = lo + 1;
  }
  cand.push_back(make_pair(dp[v], v));
}
bool get(int l, int r, int st, int en, int node) {
  if (st <= l && r <= en) {
    return seg[node];
  }
  if (st >= r || l >= en) return 0;
  int mid = (l + r) >> 1;
  return get(l, mid, st, en, node * 2) | get(mid, r, st, en, node * 2 + 1);
}
bool bad(int v) { return get(0, ve.size(), st[v], fin[v], 1); }
void update(int l, int r, int ind, int node) {
  seg[node] = 1;
  hist.push_back(node);
  if (r - l == 1) {
    return;
  }
  int mid = (l + r) >> 1;
  if (ind < mid)
    update(l, mid, ind, node * 2);
  else
    update(mid, r, ind, node * 2 + 1);
}
void check(int v) {
  if (bad(v)) return;
  int now = v;
  int cnt = 1;
  for (int i = 20; i >= 0; i--) {
    if (par[now][i] == 0) continue;
    if (!bad(par[now][i])) now = par[now][i], cnt += (1LL << i);
  }
  ans += (long long)cnt * (long long)dp[v];
  update(0, ve.size(), st[v], 1);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  adj[1].push_back(0);
  dfs_lca(1, 0);
  for (int i = 1; i <= n; i++) {
    good.push_back(make_pair((int)adj[i].size() - 1, i));
    vector<pair<int, int> > hlp;
    for (int j = 0; j < adj[i].size(); j++) {
      int u = adj[i][j];
      int tmp = (int)adj[u].size() - 1;
      hlp.push_back(make_pair(tmp, u));
    }
    sort(hlp.begin(), hlp.end());
    reverse(hlp.begin(), hlp.end());
    adj[i].clear();
    for (int j = 0; j < hlp.size(); j++) adj[i].push_back(hlp[j].second);
  }
  ans = (long long)n * (long long)n;
  sort(good.begin(), good.end());
  reverse(good.begin(), good.end());
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < good.size(); j++) {
      if (good[j].first < i) break;
      dfs(good[j].second, i);
    }
    sort(cand.begin(), cand.end());
    reverse(cand.begin(), cand.end());
    for (int j = 0; j < cand.size(); j++) {
      int now = cand[j].second;
      check(now);
    }
    cand.clear();
    for (int j = 0; j < hist.size(); j++) seg[hist[j]] = 0;
    hist.clear();
  }
  cout << ans;
}
