#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
vector<int> g[200005];
int v[200005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  while (cin >> n) {
    vector<long long> v;
    for (int i = 0; i < n; i++) {
      long long add;
      cin >> add;
      v.push_back(add);
    }
    sort(v.begin(), v.end());
    long long ans = 0;
    for (int i = 0; i < n; i++) {
      if (v[i] == v[i - 1]) continue;
      long long now = v[i];
      long long sum = 0;
      for (long long j = now; j <= 200000; j += now) {
        sum += (lower_bound(v.begin(), v.end(), j + now) -
                lower_bound(v.begin(), v.end(), j)) *
               j;
      }
      ans = max(ans, sum);
    }
    cout << ans << endl;
  }
}
