#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 100010;
const unsigned long long Base[3] = {19491001, 998244353, 1000000007};
int Node[MAXN << 1], Next[MAXN << 1], Root[MAXN], Deg[MAXN];
int sz[MAXN];
int N, cnt;
unsigned long long f[MAXN][3], g[MAXN][3];
inline void insert(int u, int v) {
  Node[++cnt] = v;
  Next[cnt] = Root[u];
  Root[u] = cnt;
}
inline unsigned long long updata(unsigned long long x, unsigned long long y,
                                 int i) {
  return x * Base[i] + y;
}
inline void dfs1(int k, int Fa) {
  for (int i = 0; i < 3; i++) g[k][i] = 1;
  sz[k] = 1;
  for (int x = Root[k]; x; x = Next[x]) {
    int v = Node[x];
    if (v != Fa) {
      dfs1(v, k);
      sz[k] += sz[v];
      for (int i = 0; i < 3; i++) g[k][i] ^= updata(g[v][i], sz[v], i);
    }
  }
}
inline void dfs2(int k, int Fa) {
  for (int i = 0; i < 3; i++)
    if (!Fa)
      f[k][i] = g[k][i];
    else
      f[k][i] =
          updata(f[Fa][i] ^ updata(g[k][i], sz[k], i), N - sz[k], i) ^ g[k][i];
  for (int x = Root[k]; x; x = Next[x]) {
    int v = Node[x];
    if (v != Fa) dfs2(v, k);
  }
}
set<pair<pair<unsigned long long, unsigned long long>, unsigned long long>> S;
int main() {
  N = read();
  for (int i = 1; i < N; i++) {
    int u = read(), v = read();
    insert(u, v);
    insert(v, u);
    ++Deg[u];
    ++Deg[v];
  }
  dfs1(1, 0);
  dfs2(1, 0);
  for (int i = 1; i <= N; i++)
    if (Deg[i] < 4) S.insert(make_pair(make_pair(f[i][0], f[i][1]), f[i][2]));
  printf("%d\n", (int)S.size());
  return 0;
}
