#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, d[N], cnt;
vector<int> g[N];
map<vector<int>, int> Hash;
map<int, int> mp[N];
set<int> s;
int dfs(int u, int f) {
  vector<int> tmp;
  if (mp[u][f]) return mp[u][f];
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == f) continue;
    tmp.push_back(dfs(v, u));
  }
  sort(tmp.begin(), tmp.end());
  if (!Hash[tmp]) Hash[tmp] = ++cnt;
  mp[u][f] = Hash[tmp];
  return Hash[tmp];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
    ++d[u], ++d[v];
  }
  for (int i = 1; i <= n; i++)
    if (d[i] < 4) s.insert(dfs(i, 0));
  int ans = s.size();
  printf("%d", ans);
  return 0;
}
