#include <bits/stdc++.h>
using namespace std;
const int N = 100005, M = 100005, mod = 1e9 + 7, base = 1e6 + 3;
inline void gmin(int &x, int y) {
  if (x > y) x = y;
}
inline void gmax(int &x, int y) {
  if (x < y) x = y;
}
inline void ch(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
struct node {
  int to, next;
} p[N << 2];
int n, cnt, tot, head[N], du[N];
map<vector<int>, int> tree;
set<int> s;
map<int, unsigned long long> dp[N];
void add(int x, int y) {
  p[++tot] = (node){y, head[x]};
  head[x] = tot;
  p[++tot] = (node){x, head[y]};
  head[y] = tot;
}
unsigned long long f1(int x) {
  return (unsigned long long)x * x * x * 198277 +
         (unsigned long long)x * x * 198281 + (unsigned long long)x * 198301 +
         198313;
}
int dfs(int x, int f) {
  if (dp[x].count(f)) return dp[x][f];
  unsigned long long ans = 1;
  int d = 0;
  vector<int> pp;
  pp.clear();
  for (int i = head[x]; i; i = p[i].next) {
    int y = p[i].to;
    if (y == f) continue;
    pp.push_back(dfs(y, x));
    d++;
  }
  sort(pp.begin(), pp.end());
  if (!tree.count(pp)) tree[pp] = ++cnt;
  dp[x][f] = tree[pp];
  return dp[x][f];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    du[x]++;
    du[y]++;
  }
  for (int i = 1; i <= n; i++)
    if (du[i] < 4) s.insert(dfs(i, 0));
  printf("%d\n", (int)s.size());
  return 0;
}
