#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N, M = 2e5; cin >> N; vector a(N), c(M + 1, 0); ll ans = 0; for(auto &i : a) { cin >> i; ans += i * N; c[i]++; } vector s(M + 2, 0); for(ll i = 0; i < M + 1; i++) { s[i + 1] = s[i] + c[i]; } vector b(M + 1, 0); for(ll i = 1; i <= M; i++) { for(ll j = 0; j <= M; j += i) { b[i] += (s[min(M + 1, j + i)] - s[j]) * (j / i); } } for(ll i = 0; i < N; i++) { ans -= a[i] * b[a[i]]; } cout << ans << "\n"; }