#include <bits/stdc++.h>
using namespace std;
long long x, y, z, a;
deque<long long> q;
bool arr[100005];
long long rec(long long n, long long s, long long n1, long long n2) {
  long long mini = 2e18, b = 2e18;
  for (int j = 2; j <= sqrt(n); j++) {
    if (n % j == 0) {
      if (n / j == j && q[n2] / j + q[n1] * j < b && q[n2] / j > 0 &&
          q[n1] * j > 0) {
        b = q[n2] / j + q[n1] * j;
        mini = j;
      } else {
        long long st = q[n2] / j + q[n1] * j;
        if (st < b && q[n2] / j > 0 && q[n1] * j > 0) {
          b = q[n2] / j + q[n1] * j;
          mini = j;
        }
        long long st1 = n / j;
        st = q[n2] / st1 + q[n1] * st1;
        if (st < b && q[n2] / st1 > 0 && q[n1] * st1 > 0) {
          b = q[n2] / st1 + q[n1] * st1;
          mini = n / j;
        }
      }
    }
  }
  return mini;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> x;
  for (int i = 0; i < x; i++) {
    cin >> z;
    q.push_back(z);
  }
  sort(q.begin(), q.end());
  bool sst = 1;
  long long maxi = 0;
  for (int i = 0, j = q.size() - 1; j >= 0; j--) {
    long long s = q[i] + q[j], ss = rec(q[j], s, i, j);
    a = q[j] / ss + q[i] * ss;
    if (ss != 2e18 && a < s) {
      maxi = max(maxi, s - a);
    }
  }
  a = 0;
  for (auto i : q) {
    a += i;
  }
  cout << a - maxi << endl;
  return 0;
}
