func_code_string: #include <bits/stdc++.h>   using namespace std;   inline long long getint() {     long long ssum = 0, ff = 1;     char ch;     for (ch = getchar(); !isdigit(ch) && ch !=  - ; ch = getchar())       ;     if (ch ==  - ) ff = -1, ch = getchar();     for (; isdigit(ch); ch = getchar()) ssum = ssum * 10 + ch -  0 ;     return ssum * ff;   }   const long long M = 1e6 + 5, mod = 1e9 + 7;   long long ans, f[M], g[M];   long long n, t[3];   signed main() {     cin >> n;     for (long long i = 1; i <= n; i++) t[getint()]++;     f[0] = 1;     f[1] = 1;     for (long long i = 2; i <= t[1]; i++)       (f[i] = f[i - 1] + f[i - 2] * (i - 1)) %= mod;     g[0] = f[t[1]];     for (long long i = 1; i <= t[2]; i++) (g[i] = g[i - 1] * (t[1] + i)) %= mod;     cout << g[t[2]] << endl;     return 0;   }   