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