#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int N = 101000;
map<vector<int>, int> pp, qq;
map<int, int> hs[N];
vector<int> e[N];
int n, u, v, m;
int dfs(int u, int f) {
  if (hs[u].count(f)) return hs[u][f];
  vector<int> s;
  for (auto v : e[u]) {
    if (v == f) continue;
    s.push_back(dfs(v, u));
  }
  sort((s).begin(), (s).end());
  if (((int)(s).size()) == 0)
    return hs[u][f] = 0;
  else {
    int ret = 0;
    if (pp.count(s))
      ret = pp[s];
    else
      ret = (pp[s] = ++m);
    return hs[u][f] = ret;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    e[u].push_back(v);
    e[v].push_back(u);
  }
  for (int i = 1; i < n + 1; i++) {
    for (auto v : e[i]) dfs(v, i);
  }
  for (int i = 1; i < n + 1; i++)
    if (((int)(e[i]).size()) < 4) {
      vector<int> s;
      for (auto v : e[i]) s.push_back(dfs(v, i));
      sort((s).begin(), (s).end());
      qq[s] = 1;
    }
  printf("%d\n", ((int)(qq).size()));
}
