#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 10;
const int inf = 0x3f3f3f3f;
const long long mod = 1000000007;
int n, cnt;
vector<int> e[N];
map<vector<int>, int> H;
map<int, int> mp[N];
set<int> st;
int dp(int x, int fa) {
  if (mp[x][fa]) return mp[x][fa];
  vector<int> cur;
  for (int i = 0; i < e[x].size(); i++) {
    if (e[x][i] != fa) {
      cur.push_back(dp(e[x][i], x));
    }
  }
  sort(cur.begin(), cur.end());
  if (!H[cur]) H[cur] = ++cnt;
  return mp[x][fa] = H[cur];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    e[u].push_back(v), e[v].push_back(u);
  }
  for (int i = 1; i <= n; i++)
    if (e[i].size() < 4) st.insert(dp(i, 0));
  printf("%d", st.size());
  return 0;
}
