#pragma GCC optimize("Ofast")   //Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  endl           "\n"
#define  pb             push_back
#define  sym(s)         s="#"+s+"#";
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  debv(a)        for(auto it: a)cout<<it<<" ";cout<<endl;
#define  deb1(a)        cout<<a<<endl;
#define  deb2(a,b)      cout<<a<<" "<<b<<endl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<endl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());

typedef  long long             ll;
typedef  unsigned long long    ull;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   N  =  3e+5+7;

vll adj[N];ll vis[N]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;
ll n,a[N];
vll v;
ll p[N],sz[N];
//<<-----Implement Functions Here---->>//
void make(){
    for(ll i = 1;i <= 2e5; i++)p[i] = i,sz[i] = 1;
}
ll find(ll x){
    return (p[x] == x)? x: p[x] = find(p[x]);
}

void merge(ll x, ll y){
    ll a = find(x);ll b = find(y);
    if(a != b){
        if(sz[a] >= sz[b])swap(a,b);
        p[a] = b;sz[b] += sz[a];
    }
    //else cycle.
}


//<<-----Start of Main--------------->>//
void MAIN(){
		cin>>n;ll ans = 0;make();set<ll>set1;
		for(ll i=1;i<=n;i++)cin>>a[i];
		for(ll i=1;i<=n;i++){
			merge(a[i],a[n-i+1]);set1.insert(a[i]);
		}
		// for(ll i=1;i<=n;i++)find(a[i]);
		for(ll i=1;i<=n;i++){
			if(vis[find(a[i])])continue;
			vis[find(a[i])] = 1;ans++;
		}
		cout<<set1.size()-ans<<endl;
			


}

int main(){
    fastio;randomINIT;

    //cin>>t;
    while(t--){
        MAIN();
    }

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}
#include<bits/stdc++.h>
using namespace std;
namespace IO
{
    const int buffer_size=1e5+5;
    char buf[buffer_size],*S,*T;
    bool flag_EOF;
    inline char read_char()
    {
        if(S==T)
            T=(S=buf)+fread(buf,1,buffer_size,stdin);
        return S!=T?*(S++):EOF;
    }
    inline int read_int()
    {
        int flag=1;
        char c=read_char();
        while(c<'0'||c>'9')
        {
            if(c==EOF)
            {
                flag_EOF=true;
                return 0;
            }
            flag=(c=='-'?-1:1);
            c=read_char();
        }
        int x=0;
        while(c>='0'&&c<='9')
        {
            x=x*10+(c^48);
            c=read_char();
        }
        return x*flag;
    }
    inline void read_string(char *s)
    {
        char x;
        do
        {
            x=read_char();
            if(x==EOF)
            {
                flag_EOF=true;
                return;
            }
        }while(x<'a'||x>'z');
        int len=0;
        while(x>='a'&&x<='z')
        {
            s[len++]=x;
            x=read_char();
        }
        s[len]='\0';
    }
    char fw[buffer_size];
    int pw;
    inline void flush()
    {
        fwrite(fw,1,pw,stdout);
        pw=0;
    }
    inline void write_char(char x)
    {
        if(pw==buffer_size)
            flush();
        fw[pw++]=x;
    }
    char st[13];
    int top;
    inline void write_int(int x)
    {
        if(!x)
        {
            write_char('0');
            return;
        }
        if(x<0)
        {
            write_char('-');
            x=-x;
        }
        while(x)
        {
            st[++top]=x%10+'0';
            x/=10;
        }
        while(top>0)
            write_char(st[top--]);
    }
    inline void write_string(const char *s)
    {
        for(int i=0;s[i];++i)
            write_char(s[i]);
    }
    inline void write_double(double x,int cnt_digits,bool mark=true)
	{
		if(x<0)
		{
			write_char('-');
			x=-x;
		}
		if(mark)
		{
			double eps=0.1;
			for(int i=1;i<=cnt_digits;++i)
				eps*=0.1;
			x+=5*eps;
		}
		write_int(int(x));
		write_char('.');
		for(int i=1;i<=cnt_digits;++i)
		{
			x-=int(x);
			x*=10;
			write_char(int(x)+'0');
		}
	}
}
const int max_N=49+5;
int X[max_N];
const int prime[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
long long Gcd(long long a,long long b)
{
	return b?Gcd(b,a%b):a;
}
int main()
{
	int N;
	scanf("%d",&N);
	for(int i=1;i<=N;++i)
		scanf("%d",X+i);
	long long ans=7e17;
	for(int s=0;s<(1<<15);++s)
	{
		long long now=1;
		for(int i=0;i<15;++i)
			now*=((s>>i)&1)?prime[i]:1;
		bool flag=true;
		for(int i=1;i<=N;++i)
		{
			if(Gcd(now,X[i])==1)
			{
				flag=false;
				break;
			}
		}
		if(flag)
			ans=min(ans,now);
	}
	printf("%lld\n",ans);
	IO::flush();
    return 0;
}

