N = int(input()) A = list(map(int, input().split())) cnt = [0]*(2*10**5+5) sm = [0]*(2*10**5+5) for i in range(N): cnt[A[i]] += 1 sm[A[i]] += A[i] for i in range(2*10**5+4): cnt[i+1] += cnt[i] sm[i+1] += sm[i] res = 0 for i in range(N): if A[i]==1:continue m = 0 res += sm[-1] for j in range(A[i],2*10**5+5,A[i]): m += (j//A[i])*(cnt[min(j+A[i],2*10**5+4)-1]-cnt[j-1]) res -= A[i]*m print(res)