N = int(input()) A = tuple(map(int, input().split())) MAX = 2 * 10 ** 5 A_freq = [0] * (MAX + 1) for a in A: A_freq[a] += 1 A_freq_acc = [0] * (MAX + 1) for i in range(1, MAX + 1): A_freq_acc[i] = A_freq_acc[i - 1] + A_freq[i] ans = N * sum(A) for a in A: div_sum = 0 for i, x in enumerate(range(a - 1, MAX, a), 1): div_sum += i * (A_freq_acc[min(x + a, MAX)] - A_freq_acc[x]) ans -= a * div_sum print(ans)