use Math::BigInt;
my $N = map {$_ - 0} split(/\s+/o, <STDIN>);
my @A = map {$_ - 0} split(/\s+/o, <STDIN>);
my $lcm = Math::BigInt::blcm(@A);
my $m = $lcm - 1;
my $t = 0;
foreach my $i (@A) {
        $t += $m % $i;
}
print $t;