#include <bits/stdc++.h>
using namespace std;
long long l[200001];
long long sumy[200001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, najw = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a > najw) najw = a;
    l[a]++;
  }
  for (int i = 1; i <= najw; i++) {
    sumy[i] = sumy[i - 1] + l[i];
  }
  long long wyn = 0;
  for (long long i = 1; i <= najw; i++) {
    if (l[i] != 0) {
      long long s = 0, j = i;
      while (j <= najw) {
        if (i + j - 1 > najw)
          s += (sumy[najw] - sumy[j - 1]) * j;
        else
          s += (sumy[i + j - 1] - sumy[j - 1]) * j;
        j += i;
      }
      if (s > wyn) wyn = s;
    }
  }
  cout << wyn;
  return 0;
}
