#include <bits/stdc++.h>
using namespace std;
void c() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int(i) = (0); (i) < (n); ++(i)) cin >> a[i];
  vector<long long> pf(n, a[0]);
  for (int(i) = (1); (i) < (n); ++(i)) pf[i] = pf[i - 1] ^ a[i];
  map<long long, vector<pair<long long, long long>>> mp;
}
void b() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int(i) = (0); (i) < (n); ++(i)) cin >> a[i];
  int sum = accumulate((a).begin(), (a).end(), 0);
  int best = sum;
  sort((a).begin(), (a).end());
  for (int(r) = (1); (r) < (n); ++(r)) {
    sum -= a[r];
    sum -= a[0];
    for (int d = 1; d * d <= a[r]; d++) {
      if (a[r] % d == 0) {
        best = min(best, sum + a[r] / d + a[0] * d);
        best = min(best, sum + a[r] / (a[r] / d) + a[0] * (a[r] / d));
      }
    }
    sum += a[r];
    sum += a[0];
  }
  cout << best;
}
int main() {
  b();
  return 0;
}
