#include <bits/stdc++.h>
using namespace std;
const int MaxN = 200050;
int n, a[MaxN], x;
long long ans, s[MaxN], cur, sum;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &x), a[x]++;
  for (int i = 1; i <= MaxN - 50; ++i) s[i] = s[i - 1] + a[i];
  int i, j;
  for (i = 1; i <= MaxN - 50; i++)
    if (s[i] - s[i - 1]) {
      cur = 0;
      for (j = 0; j <= MaxN - 50; j += i)
        cur += (long long)j * (s[min(j + i - 1, MaxN - 50)] - s[j - 1]);
      ans = max(ans, cur);
    }
  printf("%I64d", ans);
}
