#include <bits/stdc++.h>
using namespace std;
int n, cnt, u, v, deg[101000];
vector<int> G[101000];
map<vector<int>, int> mp;
map<int, int> f[101000], ans;
int dfs(int x, int fff) {
  if (f[x].count(fff)) return f[x][fff];
  vector<int> v;
  for (auto y : G[x])
    if (y != fff) v.push_back(dfs(y, x));
  sort(v.begin(), v.end());
  if (!mp.count(v)) mp[v] = ++cnt;
  return f[x][fff] = mp[v];
}
int main() {
  cin >> n;
  for (int i = n; --i;) {
    cin >> u >> v;
    ++deg[u];
    ++deg[v];
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i)
    if (deg[i] < 4) ans[dfs(i, 0)] = 1;
  cout << ans.size();
}
