#include <bits/stdc++.h>
using namespace std;
const long long N = 100005, md1 = 998244353, md2 = 1000000007;
long long n, tot = 0, Next[N * 2], to[N * 2], head[N * 2], in1[N];
map<pair<long long, long long>, long long> bo, arr;
map<pair<long long, long long>, pair<long long, long long> > num;
inline void add(long long x, long long y) {
  Next[++tot] = head[x];
  to[tot] = y;
  head[x] = tot;
}
inline void js(long long &x, long long md) {
  x %= md;
  x = x * x % md * x % md * x % md * x % md;
}
inline void Ad(long long &x, long long y, long long md) {
  x += y;
  if (x > md) x -= md;
}
inline pair<long long, long long> dfs(long long x, long long fa) {
  if (arr[pair<long long, long long>(x, fa)])
    return num[pair<long long, long long>(x, fa)];
  pair<long long, long long> re = pair<long long, long long>(1, 1), oo;
  long long i;
  for (i = head[x]; i; i = Next[i]) {
    if (to[i] != fa) {
      oo = dfs(to[i], x);
      js(oo.first, md1);
      js(oo.second, md2);
      Ad(re.first, oo.first, md1);
      Ad(re.second, oo.second, md2);
    }
  }
  arr[pair<long long, long long>(x, fa)] = 1;
  return num[pair<long long, long long>(x, fa)] = re;
}
signed main() {
  long long i, x, y, re = 0;
  scanf("%lld", &n);
  for (i = 1; i < n; i++) {
    scanf("%lld%lld", &x, &y);
    add(x, y);
    add(y, x);
    in1[x]++;
    in1[y]++;
  }
  for (i = 1; i <= n; i++) {
    if (in1[i] != 4) {
      pair<long long, long long> oo = dfs(i, 0);
      if (!bo[oo]) {
        bo[oo] = 1;
        re++;
      }
    }
  }
  printf("%lld\n", re);
}
