#include<cstdio>
#include<cmath>
using namespace std;
const int N=1010;
int n,a[N],p[N],cnt;bool isp[N];
void init(){
for (int i=2;i<N;i++)
if (!isp[i]){
p[++cnt]=i;
for (int j=i+i;j<N;j+=i) isp[j]=1;
}
}
int Mi[N];
void mul(int x){
for (int i=1;i<=cnt;i++)
while (!(x%p[i])) Mi[i]++,x/=p[i];
}
void div(int x){
for (int i=1;i<=cnt;i++)
while (!(x%p[i])) Mi[i]--,x/=p[i];
}
int main()
{
freopen("ctree.in","r",stdin);
freopen("ctree.out","w",stdout);
init();
scanf("%d",&n);
unsigned long long ans=1;
int sum=0;
for (int i=1;i<n-1;i++) mul(i);
for (int i=1;i<=n;i++){
scanf("%d",&a[i]);
if (n>1&&!a[i]) ans=0;
sum+=a[i];
for (int j=1;j<a[i];j++) div(j);
}
if (sum!=n*2-2) ans=0;
for (int i=1;i<=cnt;i++)
if (Mi[i]<0) ans=0;
else ans=ans*pow(p[i],Mi[i]);
printf("%lld\n",ans);
return 0;
}