import fractions


def main():
    n = int(input())
    a = list(map(int, input().split()))

    lcm_temp = 1

    for i in range(n):
        if(a[i] != 0):
            lcm_temp = lcm(lcm_temp, a[i])

    print(lcm_temp-1)


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


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


if __name__ == '__main__':
    main()
