n = int(input())
a = list(map(int,input().split()))
m=1
ans=0
def gcd(a, b):
 if a < b:
    a, b = b, a
 if b == 0:
    return a
 c = a % b
 return gcd(b, c)
def lcm(a,b):
    return int(a*b/gcd(a,b))
for i in range(n):
    m = lcm(m,a[i]) %(10**5)


for i in range(m):
    sum = 0
    for j in range(n):
        sum += i % a[j]
    ans = max(ans,sum)
print(ans)