#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
vector<int> g[100100];
map<vector<int>, int> mp;
map<int, int> val[100100];
set<int> st;
int n, cnt;
void dfs(int v, int p) {
  if (val[v].count(p)) return;
  for (int i = 0; i < g[v].size(); i++) {
    int u = g[v][i];
    if (u == p) continue;
    dfs(u, v);
  }
  vector<int> cur;
  for (int i = 0; i < g[v].size(); i++) {
    int u = g[v][i];
    if (u == p) continue;
    cur.push_back(val[u][v]);
  }
  sort(cur.begin(), cur.end());
  if (!mp.count(cur)) mp[cur] = ++cnt;
  val[v][p] = mp[cur];
  vector<int>().swap(cur);
}
int main() {
  n = read();
  for (int i = 1; i < n; i++) {
    int x = read(), y = read();
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (g[i].size() < 4) {
      dfs(i, 0);
      st.insert(val[i][0]);
    }
  }
  printf("%d\n", st.size());
  return 0;
}
