<?php
$n = trim(fgets(STDIN));
$a = trim(fgets(STDIN));
$as = explode(' ', $a);

$x = 1;
for($i=0;$i<$n;$i++) {
    $x = lcm($x, $as[$i]);
}

$total=0;
foreach($as as $ax) {
    $total += $ax % $x-1;
}

echo $total;

function gcd($a, $b) {
    if ($b === 0)
        return $a;

    return gcd($b, $a % $b);
}

function lcm($a, $b) {
    return $a * $b / gcd($a, $b);
}
