#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
template <typename T>
ostream& operator<<(ostream& _s, vector<T> _t) {
  for (int i = 0; i < (int)(_t.size()); i++) _s << (i ? " " : "") << _t[i];
  return _s;
}
template <typename T>
istream& operator>>(istream& _s, vector<T>& _t) {
  for (int i = 0; i < (int)(_t.size()); i++) _s >> _t[i];
  return _s;
}
template <typename T, typename U>
ostream& operator<<(ostream& _s, pair<T, U> _t) {
  _s << "(" << _t.first << "," << _t.second << ")";
  return _s;
}
template <typename T, typename U>
istream& operator>>(istream& _s, pair<T, U>& _t) {
  _s >> _t.first >> _t.second;
  return _s;
}
const int N_HASHES = 2;
using G = vector<vector<int>>;
uint64_t random64() {
  return (((uint64_t)rand() << 0) & 0x000000000000FFFFULL) |
         (((uint64_t)rand() << 16) & 0x00000000FFFF0000ULL) |
         (((uint64_t)rand() << 32) & 0x0000FFFF00000000ULL) |
         (((uint64_t)rand() << 48) & 0xFFFF000000000000ULL);
}
vector<ll> hashes[N_HASHES];
void solve() {
  int n;
  cin >> n;
  G g(n);
  for (int i = 0; i < (int)(n - 1); i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  set<vector<ll>> results;
  vector<int> q(n);
  for (int i = 0; i < (int)(N_HASHES); i++) {
    hashes[i].resize(n);
    for (int a = 0; a < (int)(n); a++) {
      hashes[i][a] = random64();
    }
  }
  for (int a0 = 0; a0 < (int)(n); a0++) {
    vector<int> dist(n, -1);
    dist[a0] = 0;
    q[0] = a0;
    int qp = 1;
    int c_dist = 0;
    vector<ll> h(N_HASHES, 0);
    for (int i = 0; i < (int)(n + 1); i++) {
      assert(qp > i || i == n);
      int a = q[i];
      if (i == n || c_dist < dist[a]) {
        results.insert(h);
      }
      if (i == n) break;
      c_dist = dist[a];
      for (int i = 0; i < (int)(N_HASHES); i++) {
        h[i] ^= hashes[i][a];
      }
      for (int b : g[a]) {
        if (dist[b] == -1) {
          dist[b] = dist[a] + 1;
          q[qp] = b;
          qp++;
        }
      }
    }
  }
  cout << results.size() << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  int t = 1;
  for (int i = 0; i < (int)(t); i++) {
    solve();
  }
}
