#include "bits/stdc++.h" #define MOD 1000000007 #define rep(i, n) for(ll i=0; i < (n); i++) #define rrep(i, n) for(ll i=(n)-1; i >=0; i--) #define ALL(v) v.begin(),v.end() #define rALL(v) v.rbegin(),v.rend() #define FOR(i, j, k) for(ll i=j;i llvec; typedef vector dvec; typedef pair P; typedef long double ld; struct edge{ll x, c;}; /************************************** ** A main function starts from here ** ***************************************/ int main(){ ll N; cin >> N; llvec nums(2e5+1, 0); llvec v(2e5+1, 0); llvec A(N); ll s = 0; rep(i, N){ cin >> A[i]; nums[A[i]]++; s += A[i]; } for(ll i = 1; i<=2e5;i++){ ll j=1; while(j*i<=2e5){ v[j*i]+=nums[i]*i; j++; } } rep(i, 2e5){ v[i+1] += v[i]; } ll ans = N*s; rep(i, N){ ans -= v[A[i]]; } cout << ans << endl; return 0; }