import sequtils, strutils, algorithm, math, future, sets, tables, hashes, intsets
let read = iterator : string {.closure.} = (while true : (for s in stdin.readLine.split : yield s))


var
  n = read().parseint
  a = newseqwith(n, read().parseint)
  lcmv = 1
  sum = 0

for i in 0 ..< n:
  lcmv = lcm(lcmv, a[i])

for i in 0 ..< n:
  sum += (lcmv - 1) mod a[i]

echo sum

