#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
map<vector<int>, int> M;
map<int, int> dp[100005];
set<int> ans;
vector<int> e[100005];
int cnt, d[100005];
void dfs(int x, int fath) {
  if (dp[x][fath] > 0) return;
  int len = e[x].size();
  vector<int> c;
  for (int i = 0; i < len; ++i)
    if (e[x][i] != fath) {
      dfs(e[x][i], x);
      c.push_back(dp[e[x][i]][x]);
    }
  sort(c.begin(), c.end());
  if (!M[c]) ++cnt, M[c] = cnt;
  dp[x][fath] = M[c];
}
int main() {
  int n, x, y;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &x, &y);
    e[x].push_back(y);
    e[y].push_back(x);
    d[x]++;
    d[y]++;
  }
  for (int i = 1; i <= n; ++i)
    if (d[i] < 4) {
      dfs(i, 0);
      ans.insert(dp[i][0]);
    }
  cout << ans.size();
  return 0;
}
