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

def lcm(a,b):
  return a//gcd(a,b)*b

n = int(input())
v = [int(x) for x in input().split()]
running = 1
for x in v:
  running = lcm(running,x)
print(x-1)
