#include <bits/stdc++.h>
using namespace std;
const int N = 50010;
int ar[N];
vector<int> di;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    sum += ar[i];
  }
  sort(ar, ar + n);
  int ans = sum;
  for (int i = 0; i < n; i++) {
    int x = ar[i];
    di.clear();
    for (int j = 1; j * j <= x; j++) {
      if (x % j == 0) {
        di.push_back(j);
        if (j * j != x) {
          di.push_back(x / j);
        }
      }
    }
    for (auto k : di) {
      int a = i == 0 ? ar[1] : ar[0];
      int b = sum - x - a;
      int d = (a * k * k) + (b * k) + x;
      ans = min(ans, d / k);
    }
  }
  cout << ans;
  return 0;
}
