#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N, res, ans;

LL gcd(LL a, LL b)
{
	if (a < b) std::swap(a, b);
	LL r = a % b;
	while (r != 0)
	{
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}

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

int main()
{
	in >> N;
	std::vector<LL>a(N);
	rep(i, N) in >> a[i];
	res = 1;
	rep(i, N)
	{
		rep(j, N)
		{
			if (i == j) continue;
			res = lcm(res, lcm(a[i], a[j]));
		}
	}
	--res;
	rep(i, N) ans += res % a[i];
	out << ans << std::endl;
	return 0;
}
