#include using namespace std; const int N = 2e5 + 5; int t, n; long long a[N], ans, sum[N], vis[N], tmp; int main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; vis[a[i]]++; sum[a[i]] += a[i]; ans += a[i]; } for (int i = 1; i <= 200000; i++) { sum[i] += sum[i - 1]; } ans *= n; for (int i = 1; i <= 200000; i++) { if (!vis[i]) { continue; } tmp = 0; for (long long l = 1, r = 0; l <= i; l = r + 1) { r = i / (i / l); tmp += (i / l) * (sum[r] - sum[l - 1]); } ans -= tmp * vis[i]; } cout << ans; return 0; }