#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<cstdlib>
#include<algorithm>
using namespace std;
const int maxn = 1e5 + 50;
bool cmp(int x, int y)
{
return x > y;
}
int main()
{
int n;
long long ans = 0;
long long a[maxn];
scanf("%d", &n);
for(int i=1;i<=n;i++)
{
scanf("%lld", &a[i]);
}
sort(a+1,a+1+n,cmp);
int flag = 0;
for(int i=1;i<=n;i++)
{
long long t = a[i];
for(int j=i+1;j<=n;j++)
{
if(t % a[j] != 0)
{
ans = t + a[j];
flag = 1;
break;
}
}
if(flag) break;
}
if(ans == 0) ans = a[1];
printf("%lld\n", ans);
return 0;
}