#include <bits/stdc++.h>
using namespace std;

int a[3010];
int main()
{
	int n;
	long long lcm = 1;
	
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		lcm = lcm / __gcd(1ll * a[i], lcm) * a[i];
	}
	lcm--;
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		ans += lcm % a[i];
	}
	printf("%lld\n", ans);
}
