#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef boost::multiprecision::cpp_int bigint;

const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

bigint gcd(bigint x, bigint y){ return y==0? x: gcd(y, x%y); }
bigint lcm(bigint x, bigint y){ return (x  / gcd(x, y) * y ); }

int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI a(n);
	rep(i,n) cin >>a[i];
	bigint bs = 1 , ans =0;
	rep(i, n) bs = lcm(bs, a[i]);
	//dbg(bs);
	rep(i, n) ans += (bs-1) % a[i];
	cout << ans <<"\n";
	return 0;
}
