#include <bits/stdc++.h>
using namespace std;
long long int a[200002], b[200002];
int main() {
  long long int n, i, sum, j, s = 0, x;
  cin >> n;
  memset(a, 0, sizeof(a));
  for (i = 0; i < n; i++) {
    cin >> x;
    a[x]++;
  }
  b[200001] = 0;
  for (i = 200000; i >= 0; i--) {
    b[i] = b[i + 1] + a[i];
  }
  for (i = 1; i <= 200000; i++) {
    sum = 0;
    if (a[i]) {
      for (j = i; j <= 200000; j += i) {
        if (j + i <= 200000)
          sum = sum + (b[j] - b[j + i]) * j;
        else
          sum = sum + b[j] * j;
      }
    }
    s = max(s, sum);
  }
  cout << s << endl;
  return 0;
}
