#include"bits/stdc++.h" #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) repi(i,0,n) #define repi(i,a,b) for(int i=(a);i<(b);++i) #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) #define All(x) (x).begin(),(x).end() #define rAll(x) (x).rbegin(),(x).rend() using namespace std; using ll = long long; int gcd(int x,int y){return y?gcd(y,x%y):x;} int main(){ int N;cin>>N; int M=0, G=0; ll S=0; vector A(N); rep(i,N){ cin>>A[i]; M=max(M, A[i]); G=gcd(G, A[i]); S += A[i]; } vector mi(M+1, 0); rep(i,N){ for(int j=1;j*j<=A[i];++j){ if(A[i]%j==0){ mi[j] += A[i] - A[i]/j; if(j*j!=A[i]){ mi[A[i]/j] += A[i]-j; } } } } ll X=S; rep(i,2,M+1) if(i%G==0){ X = min(X, S-mi[i]); } cout<