#include <bits/stdc++.h>
using namespace std;
const int mo[3] = {998244353, 1000000007, 1000000009};
const int K[3] = {137, 1003, 997};
const int maxn = 100003;
int f[maxn][3], g[maxn][3], head[maxn], deg[maxn], n;
struct EDGE {
  int to, nxt;
} edge[maxn << 1];
void addedge(int u, int v) {
  static int sz = 0;
  edge[++sz].to = v;
  edge[sz].nxt = head[u];
  head[u] = sz;
}
void dfs(int u, int pre = 0) {
  int to;
  for (int i = 0; i < 3; ++i) f[u][i] = 1;
  for (int i = head[u]; i; i = edge[i].nxt) {
    to = edge[i].to;
    if (to == pre) continue;
    dfs(to, u);
    for (int j = 0; j < 3; ++j)
      f[u][j] =
          (f[u][j] + 1ll * f[to][j] * f[to][j] % mo[j] * K[j] % mo[j]) % mo[j];
  }
}
void dfs1(int u, int pre = 0) {
  int to;
  for (int i = head[u]; i; i = edge[i].nxt) {
    to = edge[i].to;
    if (to == pre) continue;
    for (int j = 0; j < 3; ++j) {
      g[to][j] =
          (g[u][j] - 1ll * f[to][j] * f[to][j] % mo[j] * K[j] % mo[j]) % mo[j];
      g[to][j] = 1ll * g[to][j] * g[to][j] % mo[j] * K[j] % mo[j];
      g[to][j] = (g[to][j] + f[to][j]) % mo[j];
      g[to][j] = (g[to][j] + mo[j]) % mo[j];
    }
    dfs1(to, u);
  }
}
set<pair<int, pair<int, int> > > used;
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    static int u, v;
    scanf("%d%d", &u, &v);
    addedge(u, v);
    addedge(v, u);
    ++deg[u];
    ++deg[v];
  }
  dfs(1);
  for (int j = 0; j < 3; ++j) g[1][j] = f[1][j];
  dfs1(1);
  for (int i = 1; i <= n; ++i) {
    if (deg[i] < 4)
      used.insert(make_pair(g[i][0], make_pair(g[i][1], g[i][2])));
  }
  printf("%d\n", used.size());
  return 0;
}
