#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 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); vector> div(M+1); for(int i=1;i<=M;++i){ for(int j=i;j<=M;j+=i){ div[j].push_back(i); } } rep(i,N){ for(auto y:div[A[i]]){ mi[y]+=A[i]-A[i]/y; } } ll X=S; rep(i,2,M+1){ int tmp=i; if(tmp%G!=0) continue; tmp/=G; while(tmp%2==0){ tmp/=2; } if(tmp==1) X = min(X, S-mi[i]); } cout<