#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#define FAST ios::sync_with_stdio(false);
#define pb push_back
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int mod = (int)1e9 + 5;
const int maxn = (int)1e6 + 5;
using namespace std;

ll a[3005];

ll lcm(ll x, ll y){
    return x * y / __gcd(x, y);
}

int main()
{
	int n; scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%lld", a + i);
	}
	ll temp = lcm(a[1], a[2]);
	for(int i = 3; i <= n; i++){
		temp = lcm(a[i], temp);
	}
	temp--;
	ll ans = 0;
	for(int i = 1; i <= n; i++){
		ans += temp % a[i];
	}
	printf("%lld\n", ans);
	return 0;
}