#define _USE_MATH_DEFINES #include using namespace std; //template #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(v) (v).begin(),(v).end() using ll=long long int; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12; templateinline bool chmax(T& a,T b){if(ainline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} ll cnt[201010]; int main(){ int n; cin>>n; vector a(n); rep(i,0,n)cin>>a[i]; ll res=0; rep(i,0,n){ res+=a[i]; cnt[a[i]]++; } res*=n; rep(x,0,201000)cnt[x+1]+=cnt[x]; rep(y,1,200001){ for(ll x=1;;x++){ ll L=x*y-1,R=min((x+1)*y-1,200010LL); if(L>200010)break; res-=(cnt[y]-cnt[y-1])*y*(cnt[R]-cnt[L])*x; } } cout<