#include using namespace std; using ll = long long; using ld = long double; #ifdef __linux__ #define gc getchar_unlocked #define pc putchar_unlocked #else #define gc _getchar_nolock #define pc _putchar_nolock #endif inline bool blank(const char x) {return !(x^32)||!(x^10)||!(x^13)||!(x^9);} template inline void read(Tp &x) {x=0; register bool z=true; register char a=gc(); for(;!isdigit(a);a=gc()) if(a=='-') z=false; for(;isdigit(a);a=gc()) x=(x<<1)+(x<<3)+(a^48); x=(z?x:~x+1);} inline void read(double &x) {x=0.0; register bool z=true; register double y=0.1; register char a=gc(); for(;!isdigit(a);a=gc()) if(a=='-') z=false; for(;isdigit(a);a=gc()) x=x*10+(a^48); if(a!='.') return x=z?x:-x,void(); for(a=gc();isdigit(a);a=gc(),y/=10) x+=y*(a^48); x=(z?x:-x);} inline void read(char &x) {for(x=gc();blank(x)&&(x^-1);x=gc());} inline void read(char *x) {register char a=gc(); for(;blank(a)&&(a^-1);a=gc()); for(;!blank(a)&&(a^-1);a=gc()) *x++=a; *x=0;} inline void read(string &x) {x=""; register char a=gc(); for(;blank(a)&&(a^-1);a=gc()); for(;!blank(a)&&(a^-1);a=gc()) x+=a;} template inline void read(T &x,Tp &...y) {read(x),read(y...);} template inline void write(Tp x) {if(!x) return pc(48),void(); if(x<0) pc('-'),x=~x+1; register int len=0; register char tmp[64]; for(;x;x/=10) tmp[++len]=x%10+48; while(len) pc(tmp[len--]);} inline void write(const double x) {register int a=6; register double b=x,c=b; if(b<0) pc('-'),b=-b,c=-c; register double y=5*powl(10,-a-1); b+=y,c+=y; register int len=0; register char tmp[64]; if(b<1) pc(48); else for(;b>=1;b/=10) tmp[++len]=floor(b)-floor(b/10)*10+48; while(len) pc(tmp[len--]); pc('.'); for(c*=10;a;a--,c*=10) pc(floor(c)-floor(c/10)*10+48);} inline void write(const pairx) {register int a=x.first; if(a<7) {register double b=x.second,c=b; if(b<0) pc('-'),b=-b,c=-c; register double y=5*powl(10,-a-1); b+=y,c+=y; register int len=0; register char tmp[64]; if(b<1) pc(48); else for(;b>=1;b/=10) tmp[++len]=floor(b)-floor(b/10)*10+48; while(len) pc(tmp[len--]); a&&(pc('.')); for(c*=10;a;a--,c*=10) pc(floor(c)-floor(c/10)*10+48);} else cout< inline void write(T x,Tp ...y) {write(x),write(y...);} const int N = 2e5 + 1; int n; ll a[N]; ll cnt[N << 1]; ll ans; int main(){ ///ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); /// freopen("mod.in", "r", stdin); /// freopen("mod.out", "w", stdout); read(n); for(int i = 1; i <= n; i ++){ read(a[i]); cnt[a[i]] ++; ans += a[i] * n; } for(int i = 1; i < (N << 1); i ++){ cnt[i] += cnt[i - 1]; } for(int mod = 1; mod < N; mod ++){ for(int k = 0; k * mod < N; k ++){ ans -= (cnt[(k + 1) * mod - 1] - (k * mod - 1 >= 0 ? cnt[k * mod - 1] : 0)) * (cnt[mod] - cnt[mod - 1]) * (mod * k); } } write(ans); return 0; } /*** 3 1 5 3 8 8 8 8 8 8 8 8 8 ***/