#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007ll;
long long mpow(long long p, long long q) {
  p %= mod;
  long long ans = 1;
  while (q) {
    if (q & 1) ans = ans * p % mod;
    q >>= 1;
    p = p * p % mod;
  }
  return ans;
}
long long fac[1000005];
inline long long rev(long long n) { return mpow(n, mod - 2); }
inline long long C(int m, int n) {
  return fac[m] * rev(fac[n] * fac[m - n] % mod) % mod;
}
int main() {
  int n, a = 0;
  scanf("%d", &n);
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) fac[i] = fac[i - 1] * i % mod;
  for (int i = 0, p; i < n; ++i) {
    scanf("%d", &p);
    if (p <= 0) {
      --n;
      --i;
      continue;
    }
    if (p == 1) ++a;
  }
  long long ans = 1;
  for (int k = 1; k + k <= a; ++k)
    ans +=
        C(a, k + k) * fac[k + k] % mod * rev(mpow(2, k) * fac[k] % mod) % mod;
  ans = ans % mod * fac[n] % mod * rev(fac[a]) % mod;
  cout << ans << endl;
  return 0;
}
