N = int(input()) A = list(map(int, input().split())) M = 200000 D = [0] * (M + 1) DS = [0] * (M + 1) S = [0] * (M + 1) for a in A: D[a] += 1 for i in range(1, M): S[i] = S[i - 1] + i * D[i] DS[i] = DS[i - 1] + D[i] ans = 0 for i in range(2, M): if D[i] > 0: ans += S[i - 1] * D[i] for j in range(1, M // i + 1): ans += D[i] * (S[min(i * (j + 1) - 1, M)] - S[i * j] - i * j * (DS[min(i * (j + 1) - 1, M)] - DS[i * j])) print(ans)