#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
map<int, int> mp[N];
map<vector<int>, int> H;
set<int> S;
vector<int> e[N];
int n, i, x, y, tot;
inline char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int rd() {
  int x = 0, fl = 1;
  char ch = gc();
  for (; ch < 48 || ch > 57; ch = gc())
    if (ch == '-') fl = -1;
  for (; 48 <= ch && ch <= 57; ch = gc()) x = (x << 3) + (x << 1) + (ch ^ 48);
  return x * fl;
}
inline void wri(int a) {
  if (a < 0) a = -a, putchar('-');
  if (a >= 10) wri(a / 10);
  putchar(a % 10 | 48);
}
inline void wln(int a) {
  wri(a);
  puts("");
}
int dfs(int u, int fa) {
  vector<int> cnt;
  if (mp[u][fa]) return mp[u][fa];
  for (int i = 0, v; i < e[u].size(); i++)
    if ((v = e[u][i]) != fa) cnt.push_back(dfs(v, u));
  sort(cnt.begin(), cnt.end());
  if (!H[cnt]) H[cnt] = ++tot;
  return mp[u][fa] = H[cnt];
}
int main() {
  n = rd();
  for (i = 1; i < n; i++)
    x = rd(), y = rd(), e[x].push_back(y), e[y].push_back(x);
  for (i = 1; i <= n; i++)
    if (e[i].size() < 4) S.insert(dfs(i, 0));
  printf("%d", S.size());
}
