#include <stdio.h>
#include <algorithm>
using namespace std;
int use[2000010];
int main()
{
int n;
scanf("%d",&n);
for (int i=1;i<=n;i++)
{
int x;
scanf("%d",&x);
use[x]++;
}
long long ans=0;
for (int i=1;i<=2000000;i++)
{
long long tot=0;
for (int j=i;j<=2000000;j+=i)
tot+=use[j];
if (tot==1) continue;
ans=max(ans,tot*i);
}
printf("%lld\n",ans);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxhbGdvcml0aG0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgdXNlWzIwMDAwMTBdOwoKaW50IG1haW4oKQp7CiAgICBpbnQgbjsKICAgIHNjYW5mKCIlZCIsJm4pOwogICAgZm9yIChpbnQgaT0xO2k8PW47aSsrKQogICAgewogICAgICAgIGludCB4OwogICAgICAgIHNjYW5mKCIlZCIsJngpOwogICAgICAgIHVzZVt4XSsrOwogICAgfQogICAgbG9uZyBsb25nIGFucz0wOwogICAgZm9yIChpbnQgaT0xO2k8PTIwMDAwMDA7aSsrKQogICAgewogICAgICAgIGxvbmcgbG9uZyB0b3Q9MDsKICAgICAgICBmb3IgKGludCBqPWk7ajw9MjAwMDAwMDtqKz1pKQogICAgICAgICAgICB0b3QrPXVzZVtqXTsKICAgICAgICBpZiAodG90PT0xKSBjb250aW51ZTsKICAgICAgICBhbnM9bWF4KGFucyx0b3QqaSk7CiAgICB9CiAgICBwcmludGYoIiVsbGRcbiIsYW5zKTsKICAgIHJldHVybiAwOwp9Cg==