#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){ if(x>y) swap(x,y); int Lx=32-__builtin_clz(x),Ly=32-__builtin_clz(y); return x?GCD(x,y^(x<<(Ly-Lx))):y; } bool Usable(int x,int g){ int Lx=32-__builtin_clz(x),Lg=32-__builtin_clz(g); while(Lx>=Lg&&x!=0){ x^=g<<(Lx-Lg); Lx=32-__builtin_clz(x); } return x==0; } 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){ X = min(X, S-mi[i]); } cout<