fn main() {
    let _: i64 = read_line();
    let v: Vec<i64> = read_vec();

    let m = lcm_vec(&v) - 1;
    let mut ans = 0;
    for a in v {
        ans += m % a;
    }

    println!("{}", ans);
}

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

fn lcm(a: i64, b: i64) -> i64 {
    if a == 0 || b == 0 {
        0
    } else {
        b * a / gcd(a, b)
    }
}

fn lcm_vec(v: &Vec<i64>) -> i64 {
    let mut ret: i64 = 1;
    for a in v {
        ret = lcm(ret, *a);
    }
    ret
}

fn read_line<T: std::str::FromStr>() -> T {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim().split_whitespace().map(|e|
        e.parse().ok().unwrap()
    ).collect()
}

