# -*- coding: utf-8 -*-
import math
import functools

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)

N = int(input())
a = list(map(int, input().split()))

max = 0
M = lcm_list(a)
for i in range(0, M):
    ans = 0
    for j in range(0, N):
        ans += i % a[j]
    if max < ans:
        max = ans

print (max) 