from fractions import gcd
from functools import reduce

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

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

def lcm(ls):
  return reduce(lcm_base,ls)

print(lcm(a)-1)
