n = int(input()) a = list(map(int, input().split())) length = 2 * 10 ** 5 + 10 imos = [0] * length vals = [0] * length for i in range(n): vals[a[i]] += 1 for diff in range(1, length): cnt = vals[diff] for i in range(0, length, diff): if i + 1 < length: imos[i + 1] += 1 * cnt if i + diff < length: imos[i + diff] -= 1 * cnt for i in range(length - 1): imos[i + 1] += imos[i] for diff in range(1, length): cnt = vals[diff] for i in range(0, length, diff): if i + diff < length: imos[i + diff] -= (diff - 1) * cnt for i in range(length - 1): imos[i + 1] += imos[i] ans = 0 for i in range(length): ans += imos[i] * vals[i] print(ans)