#include <bits/stdc++.h>
const long long sxd = 998244353;
const long long wzp = 1000000007;
const long long K1 = 23333;
const long long K2 = 233333;
const long long N = 100005;
using namespace std;
inline long long read() {
  long long x = 0;
  char c = getchar();
  bool p = 1;
  for (; !isdigit(c); c = getchar())
    if (c == '-') p = 0;
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  return p ? x : -x;
}
struct edge {
  long long to, nt;
} e[N * 2];
long long n, x, y, r[N], ans, head[N], cnt;
void add(long long u, long long v) {
  e[++cnt] = (edge){v, head[u]};
  head[u] = cnt;
}
struct Hash {
  long long h1, h2;
  bool operator<(const Hash b) const {
    return h1 == b.h1 ? h2 < b.h2 : h1 < b.h1;
  }
};
map<long long, Hash> h[N];
map<Hash, bool> vis;
void dfs(long long u, long long fa) {
  if (h[u][fa].h1 > 0) return;
  Hash sum = (Hash){K1, K2};
  for (long long i = head[u]; i; i = e[i].nt)
    if (e[i].to != fa) {
      dfs(e[i].to, u);
      sum.h1 += ((h[e[i].to][u].h1) * (h[e[i].to][u].h1) % sxd *
                 (h[e[i].to][u].h1) % sxd);
      sum.h2 += ((h[e[i].to][u].h2) * (h[e[i].to][u].h2) % wzp *
                 (h[e[i].to][u].h2) % wzp);
    }
  h[u][fa].h1 = sum.h1 % sxd;
  h[u][fa].h2 = sum.h2 % wzp;
}
signed main() {
  n = read();
  for (long long i = 1; i < n; i++) {
    x = read();
    y = read();
    add(x, y);
    add(y, x);
    r[x]++;
    r[y]++;
  }
  for (long long i = 1; i <= n; i++)
    if (r[i] < 4) {
      dfs(i, 0);
      if (!vis[h[i][0]]) {
        vis[h[i][0]] = 1;
        ans++;
      }
    }
  cout << ans;
  return 0;
}
