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>
template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  for (const T &i : v) {
    s << i << " ";
  }
  return s;
}
struct Vertex {
  std::vector<Vertex *> chld;
  std::vector<uint32_t> heapDepth;
  uint64_t ans;
  Vertex *par;
  std::vector<uint32_t> *dp;
  Vertex() : ans(0), par(nullptr), dp(nullptr) {}
  ~Vertex() {
    if (dp != nullptr) {
      delete dp;
    }
  }
  static bool cmp(Vertex *a, Vertex *b) {
    return a->chld.size() < b->chld.size();
  }
  void root_tree() {
    for (auto it = chld.begin(); it != chld.end(); it++) {
      if (*it == par) {
        chld.erase(it);
        break;
      }
    }
    for (Vertex *v : chld) {
      v->par = this;
      v->root_tree();
    }
    std::sort(chld.begin(), chld.end(), cmp);
    std::vector<uint32_t> vals;
    vals.reserve(chld.size());
    uint32_t begInd = 0;
    for (uint32_t k = 1; k <= chld.size(); k++) {
      while ((begInd < chld.size()) && (chld[begInd]->chld.size() < k)) {
        begInd++;
      }
      if (chld.size() - begInd < k) {
        heapDepth.push_back(2);
        continue;
      }
      vals.clear();
      for (uint32_t i = begInd; i < chld.size(); i++) {
        vals.push_back(chld[i]->heapDepth[k - 1]);
      }
      std::sort(vals.rbegin(), vals.rend());
      heapDepth.push_back(vals[k - 1] + 1);
    }
  }
  uint64_t calc_ans(uint32_t n) {
    for (Vertex *v : chld) {
      uint64_t t = v->calc_ans(n);
      if ((dp == nullptr) || (dp->size() < v->dp->size())) {
        dp = v->dp;
        ans = t;
      }
    }
    if (dp == nullptr) {
      dp = new std::vector<uint32_t>();
    }
    if (heapDepth.size() > dp->size()) {
      dp->resize(heapDepth.size());
    }
    for (uint32_t i = 0; i < heapDepth.size(); i++) {
      if (heapDepth[i] > dp->at(i)) {
        ans -= dp->at(i);
        dp->at(i) = heapDepth[i];
        ans += dp->at(i);
      }
    }
    for (Vertex *v : chld) {
      if (v->dp == dp) {
        v->dp = nullptr;
        continue;
      }
      for (uint32_t i = 0; i < v->dp->size(); i++) {
        if (v->dp->at(i) > dp->at(i)) {
          ans -= dp->at(i);
          dp->at(i) = v->dp->at(i);
          ans += dp->at(i);
        }
      }
    }
    uint64_t res = ans;
    ans += n - dp->size();
    return res;
  }
};
std::vector<Vertex> tree;
void input() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  uint32_t vCnt;
  std::cin >> vCnt;
  tree.resize(vCnt);
  for (uint32_t i = 1; i < vCnt; i++) {
    uint32_t a, b;
    std::cin >> a >> b;
    a--;
    b--;
    tree[a].chld.push_back(&tree[b]);
    tree[b].chld.push_back(&tree[a]);
  }
}
int main() {
  input();
  tree[0].root_tree();
  uint64_t ans = 0;
  tree[0].calc_ans(tree.size());
  for (uint32_t i = 0; i < tree.size(); i++) {
  }
  for (Vertex &v : tree) {
    ans += v.ans;
  }
  std::cout << ans << "\n";
}
