#include <bits/stdc++.h>
const int maxN = 2e5 + 10;
std::map<std::vector<int>, int> map;
std::map<int, std::map<int, int> > fa;
std::set<int> set;
int head[maxN], next[maxN], to[maxN], deg[maxN], totE, n, cur;
void AddEdge(int u, int v) {
  next[++totE] = head[u];
  head[u] = totE;
  to[totE] = v;
  deg[u]++;
  next[++totE] = head[v];
  head[v] = totE;
  to[totE] = u;
  deg[v]++;
}
int dfs(int o, int p) {
  if (fa[o][p] != 0) return fa[o][p];
  std::vector<int> tmp;
  for (int i = head[o]; i; i = next[i]) {
    int v = to[i];
    if (v != p) tmp.push_back(dfs(v, o));
  }
  std::sort(tmp.begin(), tmp.end());
  if (!map.count(tmp)) map[tmp] = ++cur;
  return fa[o][p] = map[tmp];
}
int main() {
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  scanf("%d", &n);
  for (int i = 2, u, v; i <= n; ++i) {
    scanf("%d%d", &u, &v);
    AddEdge(u, v);
  }
  for (int i = 1; i <= n; ++i)
    if (deg[i] < 4) set.insert(dfs(i, 0));
  printf("%d", (int)set.size());
  return 0;
}
