#include <bits/stdc++.h>
using namespace std;
const int kMaxN = 1e5 + 5;
int n, sz[kMaxN];
vector<int> G[kMaxN];
set<long long> S;
map<pair<int, int>, long long> dp;
map<vector<long long>, long long> H;
const long long kHBase = 31, kHMod = 1610612741LL;
inline long long NextHash(long long cur, long long now) {
  return (cur * kHBase + now) % kHMod;
}
long long pcnt = 0;
long long GetHash(int x, int f) {
  if (dp[make_pair(x, f)]) return dp[make_pair(x, f)];
  vector<long long> v;
  for (int nxt : G[x]) {
    if (nxt == f) continue;
    v.push_back(GetHash(nxt, x));
  }
  sort(v.begin(), v.end());
  if (H.find(v) == H.end()) H[v] = ++pcnt;
  return dp[make_pair(x, f)] = H[v];
}
int main() {
  scanf("%d", &n);
  for (int i = 1, a, b; i < n; ++i) {
    scanf("%d%d", &a, &b);
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  for (int i = 1; i <= n; ++i) {
    if (G[i].size() < 4) {
      long long t = GetHash(i, 0);
      S.insert(t);
    }
  }
  printf("%d\n", (int)S.size());
  return 0;
}
