#include <bits/stdc++.h>
using namespace std;
const long long N = 200000;
long long n, x, s, ans, sum[200010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    ++sum[x];
  }
  for (int i = 1; i <= N; ++i) sum[i] += sum[i - 1];
  for (int i = 1; i <= N; ++i)
    if (sum[i] != sum[i - 1]) {
      s = 0;
      for (long long j = 1; i * j <= N; ++j)
        s += i * j * (sum[min(N, i * (j + 1) - 1LL)] - sum[i * j - 1]);
      ans = max(ans, s);
    }
  printf("%lld\n", ans);
  return 0;
}
