#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, M = 2 * N, L = 4 * N;
map<int, int> f[N];
map<vector<int>, int> has;
struct edge {
  int l, to;
} e[M];
int n, i, et, he[N], deg[N], cnt, ans;
bool have[L];
int read() {
  char c = getchar();
  int k = 0;
  for (; c < 48 || c > 57; c = getchar())
    ;
  for (; c > 47 && c < 58; c = getchar()) k = (k << 3) + (k << 1) + c - 48;
  return k;
}
void line(int x, int y) {
  e[++et].l = he[x];
  he[x] = et;
  e[et].to = y;
}
int dfs(int x, int fa) {
  if (f[x][fa]) return f[x][fa];
  vector<int> q;
  int y;
  for (int i = he[x]; i; i = e[i].l)
    if (y = e[i].to, y != fa) q.push_back(dfs(y, x));
  sort(q.begin(), q.end());
  if (!has[q]) has[q] = ++cnt;
  return f[x][fa] = has[q];
}
int main() {
  for (n = read(), i = 1; i < n; i++) {
    int x = read(), y = read();
    line(x, y);
    line(y, x);
    deg[x]++;
    deg[y]++;
  }
  for (i = 1; i <= n; i++)
    if (deg[i] < 4) have[dfs(i, 0)] = 1;
  for (i = 1; i <= cnt; i++)
    if (have[i]) ans++;
  printf("%d", ans);
}
