#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int maxN = 210000;
set<int> g[maxN];
int d[maxN];
int n;
bool used[maxN];
void removeVertex(int v, vector<int> &leafs) {
  while (!g[v].empty()) {
    int u = *g[v].begin();
    g[v].erase(g[v].begin());
    g[u].erase(v);
    if (g[u].size() == 1 && !used[u]) {
      leafs.push_back(u);
      used[u] = true;
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x;
    --y;
    ++d[x];
    ++d[y];
    g[x].insert(y);
    g[y].insert(x);
  }
  vector<int> leafs;
  for (int i = 0; i < n; ++i) {
    if (g[i].size() == 1) {
      leafs.push_back(i);
      used[i] = true;
    }
  }
  long long res = n + leafs.size();
  if (n == 2) {
    --res;
    cout << res << endl;
    return 0;
  }
  int m = n;
  int steps = 1;
  while (true) {
    ++steps;
    vector<int> nleafs;
    for (int i = 0; i < leafs.size(); ++i) {
      removeVertex(leafs[i], nleafs);
    }
    m -= leafs.size();
    res += (long long)(steps) * (long long)(nleafs.size());
    if (m <= 1) {
      --res;
      break;
    }
    leafs = nleafs;
  }
  cout << res << endl;
  return 0;
}
