#include <bits/stdc++.h>
using namespace std;
int main(void) {
  srand(time(0));
  cout << fixed << setprecision(7);
  cerr << fixed << setprecision(7);
  int n;
  static long long cnt[1 << 20];
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  while (n--) {
    int v;
    cin >> v;
    cnt[v] += 1;
  }
  const int N = 2e5 + 55;
  for (int i = 1; i <= N; ++i) cnt[i] += cnt[i - 1];
  long long ans = 0;
  for (int i = 1; i <= N; ++i)
    if (cnt[i] != cnt[i - 1]) {
      long long cur = 0;
      for (int j = 1; j * i <= N; ++j)
        cur += (cnt[min((j + 1) * i - 1, N)] - cnt[j * i - 1]) * j;
      ans = max(ans, cur * i);
    }
  cout << ans << '\n';
  cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms"
       << '\n';
  return 0;
}
