import math

N = int(input())
a = [int(i) for i in input().split()]

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

koubai = 1
for i in range(N):
    koubai = lcm(koubai, a[i])

f = [0 for i in range(koubai)]

for i in range(len(f)):
    for j in range(N):
        f[i] += i % a[j]

print(max(f))