#include <bits/stdc++.h>
using namespace std;
int n, cnt;
vector<int> adj[101010];
map<vector<int>, int> formas;
map<pair<int, int>, int> pd;
set<int> ans;
int dfs(int v, int p) {
  pair<int, int> est = make_pair(v, p);
  if (pd.find(est) != pd.end()) return pd[est];
  vector<int> filhos;
  for (int i = 0; i < (int)adj[v].size(); i++)
    if (p != adj[v][i]) filhos.push_back(dfs(adj[v][i], v));
  sort((filhos).begin(), (filhos).end());
  if (formas.find(filhos) == formas.end()) formas[filhos] = cnt++;
  return pd[est] = formas[filhos];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--, b--;
    adj[a].push_back(b), adj[b].push_back(a);
  }
  for (int i = 0; i < n; i++)
    if ((int)adj[i].size() < 4) ans.insert(dfs(i, i));
  printf("%d\n", (int)ans.size());
}
