// {{{ Template for Competitive Programming
#include <bits/stdc++.h>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/range/irange.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/math/special_functions/prime.hpp>

//#define int int64_t
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) std::accumulate(ALL(x), 0)

using namespace std;

using boost::irange;
#define irange irange<int>

using boost::integer::gcd;
using boost::math::prime;

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline void dump(T a) { cout << "[ "; for (const auto e : a) { cout << e << ", "; } cout << "]" << endl; }

int ceil(int a, int b) { return (a + (b - 1)) / b; }

const int64_t INF = (int64_t)(1e18 + 1e16) + 17;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// }}}

signed main() {
	int n; cin >> n;
	vector<int> a(n);
	long long lcm = 1;
	for (auto &e : a) {
		cin >> e;
		//lcm = boost::integer::lcm(lcm, e);
		lcm *= e;
	}

	long long sum = 0;

	for (auto e : a) {
		sum += (lcm - 1) % e;
	}

	cout << sum << endl;

}

