import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
l = [int(x) for x in input().split()]
m = lcm_list(l)
s = []
for i in range(m):
    c = 0
    for j in range(n):
        c += i % l[j]
    s.append(c)
print(max(s))