#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > tree[100005];
map<vector<int>, int> m;
int DP[200005], idx;
bool v[200005];
int solve(int node, int parent, int id) {
  int &temp = DP[id];
  if (v[id]) return temp;
  v[id] = true;
  vector<int> v;
  for (auto p : tree[node]) {
    if (parent == p.first) continue;
    v.push_back(solve(p.first, node, p.second));
  }
  sort(v.begin(), v.end());
  if (m.find(v) == m.end()) m[v] = idx++;
  return temp = m[v];
}
int main() {
  int n, x, y;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    scanf("%d %d", &x, &y);
    tree[x].push_back(make_pair(y, i * 2));
    tree[y].push_back(make_pair(x, i * 2 + 1));
  }
  set<int> second;
  for (int i = 1; i <= n; i++) {
    if (tree[i].size() == 4) continue;
    vector<int> v;
    for (auto p : tree[i]) v.push_back(solve(p.first, i, p.second));
    sort(v.begin(), v.end());
    if (m.find(v) == m.end()) m[v] = idx++;
    second.insert(m[v]);
  }
  cout << second.size();
  return 0;
}
