#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 300007;
const int MAXL = 21;
int n;
long long ans;
vector<int> ch[MAXN];
vector<int> dp[MAXN];
vector<int> tmp[MAXN];
int dm[MAXN][MAXL];
void init();
void input();
void work();
void dfs(int now, int fa);
int main() {
  init();
  input();
  work();
}
void init() { ios::sync_with_stdio(false); }
void input() {
  scanf("%d", &n);
  int u, v;
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &u, &v);
    ch[u].push_back(v), ch[v].push_back(u);
  }
}
void work() {
  dfs(1, -1);
  ans = static_cast<long long>(n) * n;
  for (int i = 1; i <= n; ++i) {
    if (ch[i].size() >= 1) ans += dp[i][1];
    for (int j = 1; j < MAXL - 2; ++j) {
      ans += j * (dm[i][j] - dm[i][j + 1]);
    }
  }
  cout << ans << endl;
}
void dfs(int now, int fa) {
  for (int i = 0; i < ch[now].size(); ++i) {
    if (ch[now][i] == fa) {
      ch[now].erase(ch[now].begin() + i);
      break;
    }
  }
  int nd = ch[now].size();
  for (int i = 0; i < nd; ++i) dfs(ch[now][i], now);
  dp[now].resize(nd + 1);
  for (int i = 1; i <= nd; ++i) tmp[i].clear();
  for (int i = 0; i < nd; ++i) {
    int v = ch[now][i];
    for (int j = 1; j <= ch[v].size(); ++j) {
      tmp[j].push_back(dp[v][j]);
    }
  }
  for (int i = 1; i <= nd; ++i) {
    if (tmp[i].size() >= i) {
      nth_element(tmp[i].begin(), tmp[i].end() - i, tmp[i].end());
      dp[now][i] = (*(tmp[i].end() - i)) + 1;
    } else
      dp[now][i] = 1;
  }
  for (int i = 0; i < nd; ++i)
    for (int j = 0; j < MAXL; ++j)
      dm[now][j] = (((dm[now][j]) > (dm[ch[now][i]][j])) ? (dm[now][j])
                                                         : (dm[ch[now][i]][j]));
  for (int i = 2; i <= nd; ++i)
    dm[now][dp[now][i]] =
        (((dm[now][dp[now][i]]) > (i)) ? (dm[now][dp[now][i]]) : (i));
  dm[now][MAXL - 1] = 1;
  for (int i = MAXL - 2; i >= 0; --i)
    dm[now][i] =
        (((dm[now][i]) > (dm[now][i + 1])) ? (dm[now][i]) : (dm[now][i + 1]));
}
