#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include<cstdint>
#include<unordered_map>
#include<boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < ( int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using uint1024_t = mp::uint1024_t;
using namespace std;

uint1024_t GCD(uint1024_t x, uint1024_t y) {
	return x ? GCD(y % x, x) : y;
}

uint1024_t LCM(uint1024_t m, uint1024_t n)
{
	if ((0 == m) || (0 == n))
		return 0;

	return ((m / GCD(m, n)) * n); // lcm = m * n / GCD(m,n)
}

int main() {
	int n;
	cin >> n;
	vector<uint1024_t>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	uint1024_t ans = 1;
	rep(i, n) {
		ans = LCM(ans, a[i]);
	}
	ans--;
	uint1024_t count = 0;
	rep(i, n) {
		count += ans % a[i];
	}
	cout << count << endl;
}