#include <bits/stdc++.h>
using namespace std;
int n, m;
long long c[1000005];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    m += (x & 1);
  }
  c[0] = c[1] = 1;
  for (long long i = 2; i <= m; i++)
    c[i] = (c[i - 1] + (i - 1) * c[i - 2]) % 1000000007;
  for (long long i = m + 1; i <= n; i++) c[i] = i * c[i - 1] % 1000000007;
  cout << c[n];
}
