#include #define REP(i,n) for(int i=0,i##_len=(n);iy) 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^=g<<(Lx-Lg); Lx=32-__builtin_clz(x); } return x==0; } int main(){ int N;cin>>N; assert(2<=N&&N<=100000); int M=0, G=0; ll S=0; vector A(N); REP(i,N){ cin>>A[i]; assert(1<=A[i]&&A[i]<=1000000); 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) if(Usable(i,G)){ X = min(X, S-mi[i]); } cout<