func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX = 1e6 + 100, MOD = 1e9 + 7;   int dp[MAX], n, tmp, cnt;   int cal(int n) {     if (n == 0 || n == 1) return 1;     if (dp[n] != -1) return dp[n];     return dp[n] = (cal(n - 1) + 1LL * cal(n - 2) * (n - 1)) % MOD;   }   int main() {     memset(dp, -1, sizeof dp);     cin >> n;     for (int i = 0; i < n; i++) {       cin >> tmp;       if (tmp == 1) cnt++;     }     int ans = cal(cnt);     for (int i = n; i > cnt; i--) ans = 1LL * ans * i % MOD;     cout << ans;   }   