#--------------------------------------------------
import strutils, sequtils, math, algorithm, tables, sets, lists, intsets, critbits, future
proc readSeq(): seq[string] =
    stdin.readLine.split
proc scanf(formatstr: cstring){.header: "<stdio.h>", varargs.}
proc scan(): int = scanf("%lld%*c",addr result)
#--------------------------------------------------
var n = scan()
var a = newSeqWith(n,scan())
var m = a.foldl(lcm(a,b)) - 1
a = @[0] & a
echo a.foldl(a + (m mod b))