import sys int1 = lambda x: int(x) - 1 # input = lambda: sys.stdin.buffer.readline() input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) i1 = lambda: int1(input()) mi = lambda: map(int, input().split()) mi1 = lambda: map(int1, input().split()) li = lambda: list(mi()) li1 = lambda: list(mi1()) lli = lambda n: [li() for _ in range(n)] INF = float("inf") mod = int(1e9 + 7) # mod = 998244353 n = ii() a = li() m = 200010 b = [0] * m d = [0] * m for x in a: b[x] += x d[x] += 1 for i in range(1, m): b[i] += b[i - 1] d[i] += d[i - 1] ans = 0 for x in a: ans += x * (d[-1] - d[x]) for y in range(x * 2, m, x): ans -= (b[y - 1] - b[y - x]) - (y - x) * (d[y - 1] - d[y - x]) print(ans)