#include <bits/stdc++.h>
#define rep(i,a,n) for(int i = a;i < n;i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

/*
ull gcd(ull a ull b){
	if(!b) return a;
	return gcd(b,a%b);
}
*/

int main(){
	int n;
	cin >> n;
	ull a[n],memo,ans = 0;
	
	rep(i,0,n){
		cin >> a[i];
		if(!i){
			memo = a[i];
		}
		else{
			memo = memo / __gcd(memo,a[i]) * a[i];
		}
	}
	
	memo--;
	
	rep(i,0,n){
		ans += memo % a[i];
	}
	
	cout << ans << endl;
	return 0;
}