#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
template <class T>
inline bool fs(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c < '0' || c > '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
long long int sat(long long int n, long long int pos) {
  return n = n | (1LL << pos);
}
long long int reset(long long int N, long long int pos) {
  return N = N & ~(1LL << pos);
}
bool cak(long long int n, long long int pos) {
  return (bool)(n & (1LL << pos));
}
long long int binPow(long long int a, long long int q, long long int mud) {
  a %= mud;
  if (q == 0) return 1;
  return ((q % 2 == 1 ? a : 1) * binPow(a * a, q / 2, mud)) % mud;
}
pair<long long int, long long int> ex_clid(long long int a, long long int b) {
  if (b == 0) return pair<long long int, long long int>(1, 0);
  pair<long long int, long long int> d = ex_clid(b, a % b);
  return pair<long long int, long long int>(d.second,
                                            d.first - d.second * (a / b));
}
long long int mod_inv(long long int n, long long int md) {
  pair<long long int, long long int> d = ex_clid(n, md);
  return ((d.first % md) + md) % md;
}
template <class T>
double dif(T &a, T &b) {
  double ans = (a.first - b.first) * (a.first - b.first) +
               (a.second - b.second) * (a.second - b.second);
  return sqrt(ans);
}
long long int ara[200000 + 5];
long long int dp[2 * 200000 + 5];
int main() {
  long long int n, x;
  fs(n);
  for (int i = 0; i < n; i++) {
    fs(x);
    ara[i] = x;
    dp[x]++;
  }
  sort(ara, ara + n);
  for (int i = 1; i <= 2 * 200000 + 2; i++) dp[i] += dp[i - 1];
  long long int sum;
  long long int mx = 0;
  for (long long int i = 0; i < n; i++) {
    sum = 0;
    if (ara[i] == ara[i + 1]) continue;
    for (long long int j = ara[i]; j <= 200000; j += ara[i])
      sum += (dp[j + ara[i] - 1] - dp[j - 1]) * j;
    mx = max(sum, mx);
  }
  cout << mx << endl;
  return 0;
}
