#include <bits/stdc++.h>
using namespace std;
map<vector<int>, int> mp;
map<int, int> dp[100050];
set<int> ans;
vector<int> vec[100050];
int n, cnt = 0;
int getid(vector<int> t) {
  if (mp.find(t) == mp.end())
    return mp[t] = ++cnt;
  else
    return mp[t];
}
int getv(int x, int y) {
  if (dp[x].find(y) != dp[x].end()) return dp[x][y];
  vector<int> tmp;
  tmp.clear();
  for (int i = 0; i <= (int)vec[x].size() - 1; i++) {
    int t = vec[x][i];
    if (t == y) continue;
    tmp.push_back(getv(t, x));
  }
  sort(tmp.begin(), tmp.end());
  return dp[x][y] = getid(tmp);
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    vec[x].push_back(y), vec[y].push_back(x);
  }
  for (int i = 1; i <= n; i++)
    if ((int)vec[i].size() < 4) ans.insert(getv(i, 0));
  printf("%d\n", (int)ans.size());
  return 0;
}
