#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL)
#define REP(i,a,b) for(int i=a,_b=b;i<=_b;i++)
#define rep(i,n) REP(i,0,n-1)
#define FORD(i,b,a) for(int i=b,_a=a;i>=_a;i--)
#define ford(i,n) FORD(i,n-1,0)
#define sqr(x) ((x)*(x))
#define ll long long
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pi>
#define vll vector<ll>
#define fi first
#define se second
#define all(a) a.begin(),a.end()
#define add push_back
#define len(arr) arr.size()
#define print(x) cout<<(x)<<'\n'
using namespace std;
 
ll a[3003];

int main() {
	SPEED;
	//freopen("in.txt", "r", stdin);
	int n; cin >> n;
	rep(i, n) cin >> a[i];
	ll x = a[0];
	REP(i, 1, n - 1){
		ll tmp = __gcd(x, a[i]);
		x = (x / tmp) * a[i];
	}
	--x;
	ll res = 0;
	rep(i, n) res += x % a[i];
	print(res);
	return 0;
}  