#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read(register T& t) {
  register T f = 1;
  register char ch = getchar();
  t = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') t = t * 10 + ch - '0', ch = getchar();
  t *= f;
  return t;
}
template <typename T, typename... Args>
inline void read(T& t, Args&... args) {
  read(t);
  read(args...);
}
const long long p = 998244353;
inline long long power(register long long x, register long long k = p - 2) {
  register long long re = 1;
  for (; k; k >>= 1, x = x * x % p)
    if (k & 1) re = re * x % p;
  return re;
}
int n;
int head[100005], to[200005], ne[200005], total = 1;
int deg[100005];
inline void add(int a, int b) {
  deg[a]++;
  total++;
  to[total] = b;
  ne[total] = head[a];
  head[a] = total;
}
map<vector<int>, int> Hash;
map<int, int> mp[100005];
int cnt;
int dfs(int now, int fa) {
  if (mp[now].count(fa)) return mp[now][fa];
  vector<int> N;
  for (int i = head[now]; i; i = ne[i])
    if (to[i] != fa) N.push_back(dfs(to[i], now));
  sort(N.begin(), N.end());
  if (Hash.count(N) == 0) Hash[N] = ++cnt;
  return mp[now][fa] = Hash[N];
}
set<int> Ans;
int main() {
  read(n);
  for (int i = 1, x, y; i < n; i++) read(x, y), add(x, y), add(y, x);
  for (int i = 1; i <= n; i++)
    if (deg[i] < 4) Ans.insert(dfs(i, i));
  printf("%d\n", Ans.size());
  return 0;
}
