#include using namespace std; const int MAXN = 200001; int n, a[MAXN], Max, l, r; long long ans, sum[MAXN]; int main() { cin >> n; for(int i = 1; i <= n; ++i) { cin >> a[i]; sum[a[i]] += a[i], ans += 1ll * a[i] * n, Max = max(Max, a[i]); } for(int i = 1; i <= Max; ++i) { sum[i] += sum[i - 1]; } for(int i = 1; i <= n; ++i) { for(l = 1; l <= a[i]; l = r + 1) { int x = a[i] / l; r = a[i] / x; ans -= 1ll * x * (sum[r] - sum[l - 1]); } } cout << ans; return 0; }