#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
set<int> calc;
map<vector<int>, int> has;
map<int, int> sav[maxn];
vector<int> lk[maxn];
int deg[maxn], n, cnt;
int dfs(int now, int pre) {
  if (sav[now][pre]) return sav[now][pre];
  vector<int> cur;
  for (int i = 0; i < lk[now].size(); i++)
    if (lk[now][i] != pre) cur.push_back(dfs(lk[now][i], now));
  sort(cur.begin(), cur.end());
  if (!has[cur]) has[cur] = ++cnt;
  return sav[now][pre] = has[cur];
}
int main() {
  scanf("%d", &n);
  for (int i = 1, u, v; i < n; i++) {
    scanf("%d%d", &u, &v);
    deg[u]++, deg[v]++;
    lk[u].push_back(v), lk[v].push_back(u);
  }
  for (int i = 1; i <= n; i++)
    if (deg[i] < 4) calc.insert(dfs(i, 0));
  printf("%d\n", calc.size());
  return 0;
}
