use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn gcd(a: u64, b: u64) -> u64 {
    if a % b == 0 {
        b
    } else {
        gcd(b, a % b)
    }
}

fn main(){
    let n: usize = read();
    let mut a = Vec::new();
    let mut m: u64 = 1;
    for _i in 0..n {
        let ai: u64 = read();
        a.push(ai);
        m = ai * m / gcd(m, ai);
    }
    m -= 1;
    let mut ans: u64 = 0;
    for i in a {
        ans += m % i;
    }
    println!("{}", ans);
}