#include <bits/stdc++.h>
using namespace std;
long long int m[200009] = {0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, i, j, ans = 0, c, N = 200005;
  cin >> n;
  long long int a[n + 1];
  a[0] = 0;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  sort(a, a + n + 1);
  for (i = 1; i <= N; i++) m[i] += m[i - 1];
  for (i = 1; i <= n; i++) {
    if (a[i] == a[i - 1]) continue;
    c = 0;
    j = 1;
    while (j * a[i] <= N) {
      c += (m[min((j + 1) * a[i] - 1, N)] - m[j * a[i] - 1]) * j * a[i];
      j++;
    }
    ans = max(ans, c);
  }
  cout << ans << "\n";
  return 0;
}
