#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
#define ll long long
const int maxn=100010;
int a[maxn];
int gcd(int a,int b)
{
return b?gcd(b,a%b):a;
}
int main ()
{
int t;
scanf("%d",&t);
for(int i=0;i<t;i++)
{
scanf("%d",&a[i]);
}
sort(a,a+t);
int lazy=0;
for(int i=t-2;i>=0;i--)
{
if(gcd(a[t-1],a[i])==1)
{
lazy=1;
printf("%d",a[t-1]+a[i]);
}
if(lazy==1)break;
}
if(lazy==0)
{
printf("%d",a[t-1]);
}
}