#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int n;
vector<int> G[N];
set<int> S;
map<int, int> mp[N];
map<vector<int>, int> H;
int cnt = 0;
int dfs(int u, int fa) {
  if (mp[u][fa]) return mp[u][fa];
  vector<int> V;
  for (int i = 0; i < G[u].size(); ++i)
    if (G[u][i] != fa) V.push_back(dfs(G[u][i], u));
  sort(V.begin(), V.end());
  if (!H[V]) H[V] = ++cnt;
  return mp[u][fa] = H[V];
}
void solve() {
  for (int i = 1; i < n; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for (int i = 1; i <= n; ++i)
    if (G[i].size() < 4) S.insert(dfs(i, 0));
  printf("%d\n", S.size());
}
int main(int argc, char const *argv[]) {
  while (scanf("%d", &n) != -1) solve();
  return 0;
}
