'use strict'
function main(input) {
  input = input.trim().split('\n')
  const N = Number(input.shift())
  input = input[0].split(' ').map(n => Number(n))
  let a = [...input]
  let ans = 0

  const lcm = (a, b) => {
    const gcd = (x, y) => y === 0 ? x : gcd(y, x%y);
    return (a * b) / gcd(a, b)
  }
  for (let i = 1; i < N; i++) {
    a[i] = lcm(a[i], a[i-1])
  }
  for (let i = 0; i < N; i++) {
    ans += (a[N-1] - 1) % input[i]
  }
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
