func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long int N = 60 + 10, M = (1 << 16) + 10, MOD = 1e9 + 7,                       INF = 2e9 + 10;   const long double PI = acos(-1);   int n, a[N], in[N], fac[N], msk[N], all;   long long int dp[M][N], ans = 1;   vector<int> adj[N], S, T;   bool mrk[N], ad[N][N];   long long int Power(long long int x, long long int y) {     if (y == 0) {       return 1ll;     }     return ((y % 2 ? x : 1) * Power((x * x) % MOD, y / 2)) % MOD;   }   void Dfs(int u) {     mrk[u] = 1;     if (in[u])       T.push_back(u);     else       S.push_back(u);     for (int v : adj[u]) {       if (!mrk[v]) {         Dfs(v);       }     }     return;   }   void Solve() {     memset(dp, 0, sizeof(dp));     int t = T.size(), s = S.size();     if (t < 2) return;     for (int i = 0; i < t; i++) {       msk[i] = 0;       for (int j = 0; j < s; j++) {         if ((a[T[i]] % a[S[j]]) == 0) {           msk[i] |= (1 << j);         }       }       dp[msk[i]][1]++;     }     for (int k = 1; k < t; k++) {       for (int mask = 1; mask < (1 << s); mask++) {         int cnt = 0;         for (int i = 0; i < t; i++) {           if ((msk[i] | mask) == mask) {             cnt++;           } else if (0 < (msk[i] & mask)) {             dp[mask | msk[i]][k + 1] += dp[mask][k];             dp[mask | msk[i]][k + 1] %= MOD;           }         }         if (k < cnt) {           dp[mask][k + 1] += (cnt - k) * dp[mask][k];           dp[mask][k + 1] %= MOD;         }       }     }     ans = (ans * dp[(1 << s) - 1][t]) % MOD;     ans = (ans * Power(fac[t - 1], MOD - 2)) % MOD;     all += (t - 1);     return;   }   void Dfs_All() {     for (int i = 0; i < n; i++) {       if (!mrk[i]) {         Dfs(i);         Solve();         S.clear();         T.clear();       }     }     return;   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     fac[0] = 1;     for (int i = 1; i < N; i++) {       fac[i] = (fac[i - 1] * i) % MOD;     }     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];       for (int j = 0; j < i; j++) {         int u = i, v = j;         if (a[v] < a[u]) swap(u, v);         if ((a[v] % a[u]) == 0) {           adj[u].push_back(v);           adj[v].push_back(u);           in[v]++;         }       }     }     Dfs_All();     ans = (ans * fac[all]) % MOD;     cout << ans <<   n ;     return 0;   }   