#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int N;
vector<int> adj[MAXN];
map<int, int> dp[MAXN];
int cid;
map<vector<int>, int> idmp;
int getid(vector<int> v) {
  if (idmp.count(v)) {
    return idmp[v];
  }
  return idmp[v] = cid++;
}
int dfs(int x, int p);
vector<int> getv(int x, int p) {
  vector<int> v;
  for (int y : adj[x]) {
    if (y == p) {
      continue;
    }
    v.push_back(dfs(y, x));
  }
  sort((v).begin(), (v).end());
  return v;
}
int dfs(int x, int p) {
  if (dp[x].count(p)) {
    return dp[x][p];
  }
  return dp[x][p] = getid(getv(x, p));
}
int main() {
  idmp[vector<int>()] = cid++;
  scanf("%d", &N);
  for (int i = 1; i < N; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 1; i <= N; i++) {
    for (int j : adj[i]) {
      dfs(j, i);
    }
  }
  set<vector<int>> st;
  for (int i = 1; i <= N; i++) {
    if (adj[i].size() < 4) {
      st.insert(getv(i, -1));
    }
  }
  printf("%lu\n", st.size());
}
