#include using namespace std; const int MAX = 200001; int main() { int N; int A[MAX], cumsum[MAX], divide[MAX]; for (int i = 0;i < MAX;++ i) cumsum[i] = divide[i] = 0; long ans = 0; cin >> N; for (int i = 0;i < N;++ i) { cin >> A[i]; ++ cumsum[A[i]]; ans += A[i]; } ans *= N; for (int i = MAX - 1;i > 0;-- i) cumsum[i - 1] += cumsum[i]; for (int i = 1;i < MAX;++ i) for(int j = i;j < MAX;j += i) divide[i] += cumsum[j]; for (int i = 0;i < N;++ i) ans -= divide[A[i]] * A[i]; cout << ans << endl; }