def f(m):
    ans = 0
    for a in aList:
        ans += m % a
    return ans

def check_finish(can):
    for a in aList:
        if(can % a != 0):
            return False
    return True
  
  
N = int(input().strip())
aList = list(map(int, input().strip().split(" ")))

count = 1
ans = 0
while(True):
    tmp_ans = f(count)
    ans = max(tmp_ans, ans)
    if(check_finish(count)):
        break
    count += 1
print(ans)