#include <cstdio>
int a[100010],sum[2],n;
bool flag;
int gcd(int a,int b)
{
	if (b==0) return a;
	else return gcd(b,a%b);
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if (a[i]>1) sum[a[i]&1]++;
	}
	if (n==1)
	{
		if (a[1]&1) printf("Second\n");
		else printf("First\n");
		return 0;
	}
	flag=false;
	while (1)
	{
		if (!sum[0]&&!sum[1])
		{
			if (!flag) printf("Second\n");
			else printf("First\n");
			return 0;
		}
		if (sum[0]&1)
		{
			if (!flag) printf("First\n");
			else printf("Second\n");
			return 0;
		}
		if (sum[1]>1||!sum[1])
		{
			if (!flag) printf("Second\n");
			else printf("First\n");
			return 0;
		}
		int GCD=-1;
		for (int i=1;i<=n;i++)
			if (a[i]>1)
			{
				if (a[i]&1)
				{
					a[i]--;break;
				}
			}
		for (int i=1;i<=n;i++)	
			if (GCD==-1) GCD=a[i];
			else GCD=gcd(a[i],GCD);
		sum[0]=sum[1]=0;
		for (int i=1;i<=n;i++)
		{
			a[i]/=GCD;
			if (a[i]>1) sum[a[i]&1]++;
		}
		flag^=1;
	}
	return 0;
}
//all is 1: who faces even number of even number, lose./odd number of even number, win.
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
static const int MAX = 510000;
static const ll MOD = 1000000007;

int main(){
    int N;
    cin>>N;
    vector<ll> A(N);
    for(int i=0; i<N; i++) cin>>A[i];
    vector<ll> color(3,0);

    ll ans = 1;

    for(int i=0; i<N; i++){
        ll kake = 0;
        for(int j=0; j<3; j++){
            if(color[j] == A[i]) kake++;
        }

        ans *= kake;
        ans %= MOD;

        for(int j=0; j<3; j++){
            if(color[j] == A[i]){
                color[j]++;
                break;
            }
        }
    }

    cout<<ans<<endl;
}