func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 1e6 + 10, mod = 1e9 + 7;   long long n, x;   long long f[N];   void solve() {     scanf( %lld , &n);     long long s1 = 0, s2 = 0, ans = 0;     for (long long i = 1; i <= n; i++) {       scanf( %lld , &x);       if (x == 1)         s1++;       else         s2++;     }     f[0] = 1, f[1] = 1;     for (long long i = 2; i <= s1; i++)       f[i] = (f[i - 1] + (i - 1) * f[i - 2]) % mod;     ans = f[s1];     for (long long i = s1 + 1; i <= n; i++) ans = ans * i % mod;     printf( %lld , ans);   }   signed main() { solve(); }   