from bisect import bisect_left, bisect_right def cnt_quotient(Number, quioitent, List): return len(List) - bisect_right(List, Number*quioitent-1) def main(): N = int(input()) a = list(map(int, input().split())) a.sort() res = 0 s = sum(a) visited = [False for i in range(2*10**5+1)] val = [0 for i in range(2*10**5+1)] for v in a: if visited[v] == True: res += val[v] continue else: visited[v] = True tmp_sum = s for i in range(1, 2*10**5+1): if v*i > 2*10**5: break else: tmp_sum -= v*cnt_quotient(v, i, a) res += tmp_sum val[v] = tmp_sum print(res) return if __name__ == "__main__": main()