#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin>>n; ll sum=0; vector A(n); map m; rep(i,n){ cin>>A[i]; sum+=A[i]; m[A[i]]++; } sum*=n; sort(ALL(A)); ll cnt=0; for(auto [a,b]:m){ ll tmp=0; for(int i=1;i*a<=200000;i++){ auto l=lower_bound(ALL(A),i*a)-A.begin(); auto r=lower_bound(ALL(A),(i+1)*a)-A.begin(); tmp+=(r-l)*i; } cnt+=a*b*tmp; } cout<