#include using namespace std; const int N = 2e5 + 5; int t, n; long long a[N], ans, maxi, sum[N], tmp; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; maxi = max(maxi, a[i]); sum[a[i]] += a[i]; ans += a[i]; } for (int i = 1; i <= maxi + 1; i++) { sum[i] += sum[i - 1]; } ans *= n; for (int i = 1; i <= n; i++) { tmp = 0; for (long long l = 1, r = 0; l <= a[i]; l = r + 1) { r = a[i] / (a[i] / l); tmp += (a[i] / l) * (sum[r] - sum[l - 1]); } ans -= tmp; } cout << ans; return 0; }