#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <deque>

#define INF 100000000
#define MOD 1000000007

#define ll long long

using namespace std;

int main() {

	ll n, max;

	ll a[3005] = {};
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	max = a[0];

	for (int i = 1; i < n; i++) {

		max = lcm(max, a[i]);
	}
	
	int ans = 0;

	for (int i = 0; i < n; i++)
	{
		ans += (max - 1) % a[i];
	}
	
	cout << ans << endl;
}