import numpy as np
N = int(input())
alist = np.array(list(map(int, input().split())))


def f(m):
    return np.sum(np.mod(alist, m))


max_num = 0
for m in range(1, 10**5 + 1):
    num = f(m)
    if num > max_num:
        max_num = num

print(max_num - N)
