#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <iostream>
#include <string>
#include <set>
#include <map>
using namespace std;
const int N=int(2e6)+2;
bool is[N];
int prv[N],d,n,a[200100];
int ans[N];
int s[1000],top,x,no,num[1000],so,mu,cur;
pair<int,int> v[1000];
long long kq=0LL;
int main(){
for(int i=4;i<N;i+=2){
is[i]=1;prv[i]=2;
}
for(int i=3;i<N;i+=2) if (!is[i]) for(d=i+i;d<N;d+=i){
if (!prv[d]) prv[d]=i;
is[d]=1;
}
scanf("%d",&n);
int i,j,k;
for(i=0;i<n;++i){
scanf("%d",&x);
if (x==1){continue;}
top=0;
while (x>1){
if (!is[x]){s[top++]=x;break;}
s[top++]=prv[x];
x/=prv[x];
}
sort(s,s+top);
no=0;
v[no++]=make_pair(s[0],1);
for(j=1;j<top;++j) if (s[j]!=s[j-1]) v[no++]=make_pair(s[j],1);
else v[no-1].second++;
so=cur=1;
num[0]=1;
for(j=0;j<no;++j){
cur=so;mu=1;
while (v[j].second--){
mu*=v[j].first;
for(k=0;k<cur;++k) num[k+so]=mu*num[k];
so+=cur;
}
cur=so;
}
for(j=0;j<so;++j) ans[num[j]]++;
}
kq=1LL*n;
for(int i=1;i<N;++i) if (ans[i]>1) kq=max(kq,1LL*i*ans[i]);
cout<<kq;
return 0;
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDxjc3RyaW5nPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPHNldD4KI2luY2x1ZGUgPG1hcD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpjb25zdCBpbnQgTj1pbnQoMmU2KSsyOwpib29sIGlzW05dOwppbnQgcHJ2W05dLGQsbixhWzIwMDEwMF07CmludCBhbnNbTl07CmludCBzWzEwMDBdLHRvcCx4LG5vLG51bVsxMDAwXSxzbyxtdSxjdXI7CnBhaXI8aW50LGludD4gdlsxMDAwXTsKbG9uZyBsb25nIGtxPTBMTDsKCmludCBtYWluKCl7CiAgICBmb3IoaW50IGk9NDtpPE47aSs9Mil7CiAgICAgICAgaXNbaV09MTtwcnZbaV09MjsKICAgIH0KICAgIGZvcihpbnQgaT0zO2k8TjtpKz0yKSBpZiAoIWlzW2ldKSBmb3IoZD1pK2k7ZDxOO2QrPWkpewogICAgICAgIGlmICghcHJ2W2RdKSBwcnZbZF09aTsKICAgICAgICBpc1tkXT0xOwogICAgfQogICAgc2NhbmYoIiVkIiwmbik7CiAgICBpbnQgaSxqLGs7CiAgICBmb3IoaT0wO2k8bjsrK2kpewogICAgICAgIHNjYW5mKCIlZCIsJngpOwogICAgICAgIGlmICh4PT0xKXtjb250aW51ZTt9CiAgICAgICAgdG9wPTA7CiAgICAgICAgd2hpbGUgKHg+MSl7CiAgICAgICAgICAgIGlmICghaXNbeF0pe3NbdG9wKytdPXg7YnJlYWs7fQogICAgICAgICAgICBzW3RvcCsrXT1wcnZbeF07CiAgICAgICAgICAgIHgvPXBydlt4XTsKICAgICAgICB9CiAgICAgICAgc29ydChzLHMrdG9wKTsKICAgICAgICBubz0wOwogICAgICAgIHZbbm8rK109bWFrZV9wYWlyKHNbMF0sMSk7CiAgICAgICAgZm9yKGo9MTtqPHRvcDsrK2opIGlmIChzW2pdIT1zW2otMV0pIHZbbm8rK109bWFrZV9wYWlyKHNbal0sMSk7CiAgICAgICAgZWxzZSB2W25vLTFdLnNlY29uZCsrOwogICAgICAgIHNvPWN1cj0xOwogICAgICAgIG51bVswXT0xOwogICAgICAgIGZvcihqPTA7ajxubzsrK2opewogICAgICAgICAgICBjdXI9c287bXU9MTsKICAgICAgICAgICAgd2hpbGUgKHZbal0uc2Vjb25kLS0pewogICAgICAgICAgICAgICAgbXUqPXZbal0uZmlyc3Q7CiAgICAgICAgICAgICAgICBmb3Ioaz0wO2s8Y3VyOysraykgbnVtW2src29dPW11Km51bVtrXTsKICAgICAgICAgICAgICAgIHNvKz1jdXI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY3VyPXNvOwogICAgICAgIH0KICAgICAgICBmb3Ioaj0wO2o8c287KytqKSBhbnNbbnVtW2pdXSsrOwogICAgfQogICAga3E9MUxMKm47CiAgICBmb3IoaW50IGk9MTtpPE47KytpKSBpZiAoYW5zW2ldPjEpIGtxPW1heChrcSwxTEwqaSphbnNbaV0pOwogICAgY291dDw8a3E7CiAgICByZXR1cm4gMDsKfQo=