#include <bits/stdc++.h>
int CH, NEG;
template <typename TP>
inline void read(TP& ret) {
  ret = NEG = 0;
  while (CH = getchar(), CH < '!')
    ;
  if (CH == '-') NEG = true, CH = getchar();
  while (ret = ret * 10 + CH - '0', CH = getchar(), CH > '!')
    ;
  if (NEG) ret = -ret;
}
using namespace std;
int n, idx = 0;
int ans[100010LL];
vector<int> G[100010LL];
map<int, int> R[100010LL];
map<int, int>::iterator it;
map<vector<int>, int> H;
map<vector<int>, int>::iterator it2;
set<int> S;
int dp(int u, int fa) {
  if (it = R[u].find(fa), it != R[u].end()) return it->second;
  vector<int> now;
  int i;
  for (i = (0); i < (G[u].size()); i++)
    if (G[u][i] != fa) now.push_back(dp(G[u][i], u));
  sort(now.begin(), now.end());
  if (it2 = H.find(now), it2 == H.end())
    return R[u][fa] = H[now] = ++idx;
  else
    return R[u][fa] = it2->second;
}
int main() {
  int i, n, u, v;
  read(n);
  for (i = (1); i < (n); i++) {
    read(u), read(v);
    G[u].push_back(v), G[v].push_back(u);
  }
  for (i = (1); i <= (n); i++)
    if (G[i].size() < 4) S.insert(dp(i, 0));
  printf("%d\n", S.size());
END:
  getchar(), getchar();
  return 0;
}
