use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    token.parse().ok().unwrap()
}

fn main() {
    let n = input::<usize>();
    let a = (0..n).map(|_| input()).collect::<Vec<i64>>();

    let lcm = a[1..].iter().fold(a[0], |acc, &a| lcm(acc, a));
    let sum = a.iter().map(|a| (lcm - 1) % a).sum::<i64>();
    println!("{}", sum);
}

fn gcd(x: i64, y: i64) -> i64 {
    if y == 0 {
        x
    } else {
        gcd(y, x % y)
    }
}

fn lcm(x: i64, y: i64) -> i64 {
    x * y / gcd(x, y)
}
