#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
const int N = 100005;
struct Hash {
  size_t operator()(const vector<int> &a) const {
    size_t ret = 0;
    for (auto x : a) ret ^= hash<int>()(x);
    return ret;
  }
};
unordered_map<vector<int>, int, Hash> mp;
unordered_map<int, int> f[N];
vector<int> g[N];
int n, cnt, deg[N], lab[N];
int dfs(int u, int p) {
  if (f[u][p]) return f[u][p];
  vector<int> cur;
  for (auto v : g[u])
    if (v != p) cur.push_back(dfs(v, u));
  sort(cur.begin(), cur.end());
  if (!mp.count(cur)) mp[cur] = ++cnt;
  return f[u][p] = mp[cur];
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    deg[u]++, deg[v]++;
    g[u].push_back(v), g[v].push_back(u);
  }
  set<int> res;
  for (int i = 1; i <= n; i++)
    if (deg[i] < 4) res.insert(dfs(i, 0));
  cout << res.size() << endl;
}
