#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
const int maxn = 100010;
const int inf = 0x3f3f3f3f;
int n,m,k,t,ans;
int a[maxn];
string s;
int main(){
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
sort(a,a+n);
ans=0;
for(int i=n-2;i>=0;i--){
if(a[n-1]%a[i]!=0) {
ans=a[n-1]+a[i];
break;
}
}
if(ans==0) ans=a[n-1];
printf("%d\n",ans);
}