#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
int cnt[maxn + 10] = {0};
int main() {
  int n;
  cin >> n;
  int x;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    cnt[x]++;
  }
  for (int i = 1; i <= maxn; i++) {
    cnt[i] += cnt[i - 1];
  }
  long long ans = 0, tmp;
  for (int i = 1; i <= maxn; i++) {
    if (cnt[i] - cnt[i - 1]) {
      tmp = 0;
      for (int j = 0; j <= maxn; j += i) {
        tmp += (long long)j * (cnt[min(maxn, j + i - 1)] - cnt[j - 1]);
      }
      ans = max(ans, tmp);
    }
  }
  cout << ans << endl;
}
