#include <bits/stdc++.h>
using namespace std; 
 
#define ll          long long int
#define pb          push_back
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define inf         INT_MAX
#define rep(i,a,b)  for(i=a;i<b;i++)

template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }

const int N = 2e5 + 5;
const ll mod = 1e9 + 7;

void solve()
{
	ll n, i, ans = 2;
	cin >> n;
	vector<ll> v;
	n = n * 2;
	for(i = 2 ; i*i <= n ; i++)
	{
		if(n % i == 0)
		 v.pb(i);
	}
	for(auto i : v)
	{
		ll l, r, a, b;
		a = i;
		b = n / i;
		l = (b - 1 - a)/2;
		r = (a + b - 1)/2;
		if((b - 1 - a) & 1 || (a + b - 1) & 1) continue;
		l = (b - 1 - a)/2;
		r = (a + b - 1)/2;
		if(l >= 0) ans += 2;
	}
	cout << ans;
}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll  long long
#define pb push_back
#define vec vector<ll>
#define pii pair<ll,ll>
#define pr_que priority_queue<pii,vector<pii>,greater<pii> >
#define itr(i,x,y) for(ll i=x;i<y;i++)
#define mod 1000000007
const long long N=200001,INF=2000000000000000000;
const double err=1e-9;
ll gcd(ll a,ll b)
{
	if(b==0) return a;
	else return gcd(b,a%b);
}
int main()
{
	IOS;
	ll n,ans=INF;
	cin >> n;
	int a[n];
	itr(i,0,n) 
	{
		cin >> a[i];
	}
	int arr[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
	for(int mask=0;mask<(1<<15);mask++)
	{
		ll tmp=1,c=0;
		for(int i=0;i<15;i++)
		{
			if(mask&(1<<i))
			{
				tmp*=arr[i];
			}
		}
		for(int i=0;i<n;i++)
		{
			if(gcd(a[i],tmp)==1) 
			{
				c=1;
				break;
			}
		}
		if(c==0) ans=min(ans,tmp);
	}
	cout << ans;
	
	return 0;
}
