#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, tot;
vector<int> G[N];
map<vector<int>, int> hs;
map<int, int> h[N];
set<int> s;
int dfs(int u, int fa) {
  if (h[u][fa]) return h[u][fa];
  vector<int> now;
  for (int v : G[u])
    if (v != fa) now.push_back(dfs(v, u));
  sort(now.begin(), now.end());
  if (!hs[now]) hs[now] = ++tot;
  return h[u][fa] = hs[now];
}
int main() {
  scanf("%d", &n);
  for (int i = 1, a, b; i < n; ++i)
    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", s.size());
  return 0;
}
