#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, tot;
int ans[100005];
int son[100005];
int head[100005], nxt[100005 * 2], to[100005 * 2], cnt;
map<int, int> mp[100005];
map<vector<int>, int> H;
set<int> st;
inline void add_edge(int a, int b) {
  to[++cnt] = b;
  nxt[cnt] = head[a];
  head[a] = cnt;
  to[++cnt] = a;
  nxt[cnt] = head[b];
  head[b] = cnt;
}
int dp(int x, int fa) {
  if (mp[x][fa]) return mp[x][fa];
  vector<int> cur;
  for (int i = head[x]; i; i = nxt[i])
    if (to[i] != fa) cur.push_back(dp(to[i], x));
  sort(cur.begin(), cur.end());
  if (!H[cur]) H[cur] = ++tot;
  return mp[x][fa] = H[cur];
}
int main() {
  n = read();
  for (int i = 1; i < n; i++) {
    int u = read(), v = read();
    add_edge(u, v);
    son[u]++;
    son[v]++;
  }
  for (int i = 1; i <= n; i++)
    if (son[i] < 4) st.insert(dp(i, 0));
  printf("%d\n", st.size());
  return 0;
}
