#include <bits/stdc++.h>
const int MAXN = 100000;
using namespace std;
void read(int &x) {
  x = 0;
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  }
}
int n;
namespace tree {
int deg[MAXN + 5];
vector<int> adj[MAXN + 5];
void addedge(int u, int v) {
  adj[u].push_back(v), adj[v].push_back(u);
  ++deg[u], ++deg[v];
}
int cnt;
map<vector<int>, int> mp;
map<int, int> h[MAXN + 5];
int dfs(int u, int fa) {
  if (h[u][fa]) return h[u][fa];
  vector<int> vec;
  vec.clear();
  for (int v : adj[u]) {
    if (v == fa) continue;
    vec.push_back(dfs(v, u));
  }
  sort(vec.begin(), vec.end());
  if (!mp[vec]) mp[vec] = ++cnt;
  return h[u][fa] = mp[vec];
}
set<int> S;
void solve() {
  cnt = 0;
  for (int i = 1; i <= n; ++i) {
    if (deg[i] < 4) S.insert(dfs(i, 0));
  }
  printf("%d\n", int(S.size()));
}
}  // namespace tree
void init() {
  read(n);
  for (int i = 1; i < n; ++i) {
    int u, v;
    read(u), read(v);
    tree::addedge(u, v);
  }
}
int main() {
  init();
  tree::solve();
  return 0;
}
