#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 79;
vector<vector<int> > g(maxn);
vector<int> l(maxn, 0), et;
map<vector<int>, int> m;
int cnt = 0;
void recalculate_label(int v, int skip = -1) {
  vector<int> h;
  for (int i : g[v]) {
    if (i == skip) continue;
    h.push_back(l[i]);
  }
  h.resize(4, -1);
  sort(h.begin(), h.end());
  if (!m.count(h)) m[h] = cnt++;
  l[v] = m[h];
}
void dfs(int v = 0, int p = -1) {
  et.push_back(v);
  vector<int> h;
  for (int i : g[v]) {
    if (i == p) continue;
    dfs(i, v);
    et.push_back(v);
  }
  recalculate_label(v, p);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0, u, v; i < n - 1; i++) {
    cin >> u >> v;
    g[--u].push_back(--v);
    g[v].push_back(u);
  }
  dfs();
  set<int> values;
  if (g[et[0]].size() < 4) values.insert(l[et[0]]);
  for (int i = 1; i < et.size(); i++) {
    recalculate_label(et[i - 1], et[i]);
    recalculate_label(et[i]);
    if (g[et[i]].size() < 4) values.insert(l[et[i]]);
  }
  cout << values.size() << "\n";
  return 0;
}
