#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int arr[n];
  int total = 0;
  int maxVal = -1;
  for (int i = 0; i < n; i++) {
    int s;
    scanf("%d", &s);
    total += s;
    arr[i] = s;
    maxVal = max(maxVal, s);
  }
  int prime[maxVal + 1];
  for (int i = 0; i <= maxVal; i++) {
    prime[i] = 0;
  }
  for (int i = 2; i <= maxVal; i++) {
    for (int j = i * i; j <= maxVal; j += i) {
      prime[j] = 1;
    }
  }
  sort(arr, arr + n);
  int index = n - 1;
  int diff = 0;
  while (index > 0) {
    if (prime[arr[index]] == 0) {
      index--;
      continue;
    }
    int currBest = arr[index] + arr[0];
    for (int i = 2; i < arr[index]; i++) {
      if (arr[index] % i == 0) {
        int newBest = (arr[index] / i) + (arr[0] * i);
        diff = max(currBest - newBest, diff);
      }
    }
    index--;
  }
  total -= diff;
  cout << total << endl;
  return 0;
}
