import std.stdio;
import std.ascii;
import std.conv;
import std.string;
import std.algorithm;
import std.range;
import std.functional;
import std.math;
import core.bitop;
import std.numeric;

void main()
{
    readln;
    auto A = readln.chomp.split.to!(long[]);
    // auto lcm = (long a, long b) => a * b / gcd(a, b);
    // auto f = (long[] A, long x) => A.map!(a => x % a).sum();
    // f(A, reduce!lcm(A) - 1).writeln;

    long m = A[0];
    foreach (a; A[1 .. $])
        m = (m * a) / gcd(m, a);
    long result;
    foreach (a; A)
        result += (m - 1) % a;
    result.writeln;
}
