#pragma GCC optimize("Ofast") #pragma GCC target("avx2") char*mmap(); #define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;} #define wt(v) {long _z=v;do*--wp=_z%10+48;while(_z/=10);} #define rep(v,e) for(long v=0;v=s;) long b[200002],c[200002]; main(){ long z=0; char*rp=mmap(0l,1l<<25,1,2,0,0ll); rd(n); rep(i,n){ rd(a); ++c[a]; } rrep3(a,1,200001){ b[a]=b[a+1]-c[a]; long u=n; rep4(t,a,200001,a){ u+=b[t]; } z+=u*a*c[a]; } char wbuf[64],*wp=wbuf+sizeof wbuf; wt(z); write(1,wp,wbuf+sizeof wbuf-wp); _exit(0); }