func_code_string: #include <bits/stdc++.h>   int n;   char str[50];   int F[50], sz[50];   inline int find(int x) { return x == F[x] ? x : F[x] = find(F[x]); }   inline void merge(int x, int y) {     x = find(x);     y = find(y);     if (x == y) return;     F[y] = x;     sz[x] += sz[y];   }   std::vector<int> G[55];   int id[66];   int e[25];   int f[(1 << 23) + 5], g[(1 << 23) + 5], coe[(1 << 23) + 5];   int main() {     scanf( %d , &n);     for (int i = 0; i <= n - 1; ++i) F[i] = i, sz[i] = 1;     for (int i = 0; i <= n - 1; ++i) {       scanf( %s , str);       for (int j = i + 1; j <= n - 1; ++j) {         if (str[j] ==  A ) merge(i, j);         if (str[j] ==  X ) G[i].emplace_back(j), G[j].emplace_back(i);       }     }     int ans = n - 1;     n = 0;     for (int i = 0; i <= ans; ++i) id[i] = find(i);     for (int i = 0; i <= ans; ++i)       for (auto x : G[i])         if (id[i] == id[x]) {           puts( -1 );           exit(0);         }     for (int i = 0; i <= ans; ++i) {       if (sz[id[i]] == 1) {         id[i] = -1;         continue;       }       if (id[i] != i) {         id[i] = id[id[i]];         continue;       }       id[i] = n++;     }     if (n <= 1) {       printf( %d n , ans + n);       return 0;     }     assert(n <= 23);     for (int i = 0; i <= ans; ++i)       for (auto x : G[i])         if (~id[i] && ~id[x]) e[id[i]] |= (1 << id[x]);     f[0] = coe[0] = 1;     for (int S = 1; S <= (1 << n) - 1; ++S) {       int lb = __builtin_ctz(S);       f[S] = (!(e[lb] & S)) & f[S ^ (1 << lb)];       coe[S] = -coe[S ^ (1 << lb)];     }     for (int i = 0; i <= n - 1; ++i) {       for (int S = 0; S <= (1 << n) - 1; ++S) {         if ((S >> i) & 1) f[S] += f[S ^ (1 << i)];       }     }     for (int i = 0; i <= (1 << n) - 1; ++i) g[i] = f[i];     for (int k = 1; k <= n; ++k) {       auto chk = [&]() {         int ans = 0;         for (int S = 0; S <= (1 << n) - 1; ++S) ans += g[S] * coe[S];         return ans != 0;       };       if (chk()) {         printf( %d n , ans + k);         return 0;       }       for (int S = 0; S <= (1 << n) - 1; ++S) g[S] *= f[S];     }     return 0;   }   