func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 210000;   int n;   int oke[maxn], okp[maxn];   struct edge {     int y, nex;   } a[maxn << 1];   int len, fir[maxn];   inline void ins(const int x, const int y) {     a[++len] = (edge){y, fir[x]};     fir[x] = len;   }   int siz[maxn], mxs[maxn];   void dfs(const int x, const int fa) {     siz[x] = 1;     for (int k = fir[x], y = a[k].y; k; k = a[k].nex, y = a[k].y)       if (y != fa) {         dfs(y, x);         siz[x] += siz[y];         mxs[x] = max(mxs[x], siz[y]);       }   }   int root, t1, t2;   int d[maxn], f[maxn], f2[maxn];   bool cmp(const int x, const int y) {     return f[x] == f[y] ? f2[x] < f2[y] : f[x] < f[y];   }   int t[maxn], tp;   void Hash(const int x, const int fa) {     siz[x] = 1;     for (int k = fir[x], y = a[k].y; k; k = a[k].nex, y = a[k].y)       if (y != fa && oke[k]) Hash(y, x), siz[x] += siz[y];     tp = 0;     for (int k = fir[x], y = a[k].y; k; k = a[k].nex, y = a[k].y)       if (y != fa && oke[k]) t[++tp] = y;     sort(t + 1, t + tp + 1, cmp);     d[x] = tp + (fa != 0);     f[x] = f2[x] = siz[x];     for (int i = 1; i <= tp; i++) {       int y = t[i];       f[x] = f[x] * (siz[y] + 1) * f[y];       f2[x] = f2[x] + (siz[y] + 2) * (f2[y] + 1);     }   }   int ans[maxn];   void cal(const int x, const int fa) {     if (okp[x] && d[x] < 4) ans[x]++;     for (int k = fir[x], y = a[k].y; k; k = a[k].nex, y = a[k].y)       if (y != fa && oke[k]) cal(y, x);     tp = 0;     for (int k = fir[x], y = a[k].y; k; k = a[k].nex, y = a[k].y)       if (y != fa && oke[k]) t[++tp] = y;     sort(t + 1, t + tp + 1, cmp);     for (int i = 1; i <= tp; i++) {       int y = t[i], ty = t[i - 1];       if (f[y] != f[ty] || f2[y] != f2[ty]) ans[x] += ans[y];     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i < n; i++) {       int x, y;       scanf( %d%d , &x, &y);       ins(x, y), ins(y, x);     }     dfs(1, 0);     for (int i = 1; i <= n; i++)       if (mxs[i] * 2 <= n && (n - siz[i]) * 2 <= n) {         if (!t1)           t1 = i;         else           t2 = i;       }     for (int i = 1; i <= len; i++) oke[i] = 1;     for (int i = 1; i <= n; i++) okp[i] = 1;     if (t2) {       for (int k = fir[t1], y = a[k].y; k; k = a[k].nex, y = a[k].y)         if (y == t2) oke[k] = 0;       for (int k = fir[t2], y = a[k].y; k; k = a[k].nex, y = a[k].y)         if (y == t1) oke[k] = 0;       okp[root = ++n] = 0;       ins(root, t1), ins(root, t2);       oke[len - 1] = oke[len] = 1;     } else       root = t1;     Hash(root, 0);     cal(root, 0);     printf( %d n , ans[root]);     return 0;   }   