#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const double pi = 3.1415926535897932384626;
long long powmod(long long a, long long b) {
  long long res = 1;
  long long rem = a % mod;
  for (; b; b >>= 1) {
    if (b & 1) res = (res * rem) % mod;
    rem = (rem * rem) % mod;
  }
  return res;
}
const int N = 200008;
int cnt[N];
int num[N];
int main() {
  int n = 0;
  int ind = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int a = 0;
    scanf("%d", &a);
    if (!cnt[a]) num[++ind] = a;
    ++cnt[a];
  }
  sort(num + 1, num + ind + 1);
  for (int i = 1; i <= N; ++i) {
    cnt[i] += cnt[i - 1];
  }
  long long mx = 0ll;
  long long tm = 0ll;
  for (int i = 1; i <= ind; ++i) {
    tm = 0ll;
    for (int j = num[i]; j <= N; j += num[i]) {
      tm += 1ll * j * (cnt[min(N, j + num[i] - 1)] - cnt[j - 1]);
    }
    mx = max(mx, tm);
  }
  printf("%lld\n", mx);
  return 0;
}
