#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/math/tools/minima.hpp>

#define rep(i, n) for (int i = 0; i < (n); ++i)

namespace adaptor = boost::adaptors;
using namespace std;
using boost::math::tools::brent_find_minima;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::split;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP

void	Main()
{
	int	n;
	cin >> n;
	vector<unsigned long long>	V(n);
	rep(i, n)
		cin >> V.at(i);
	unsigned long long	gcdv;
	unsigned long long	lcmv;
	lcmv = V.at(0);
	rep(i, n - 1)
	{
		unsigned long long	temp;
		temp = lcmv;
		gcdv = __gcd(lcmv, V.at(i + 1));
		lcmv = temp * V.at(i + 1) / gcdv;
	}
	unsigned long long	sum;
	sum = 0;
	rep(i, n)
		sum += (lcmv - 1) % V.at(i);
	cout << sum << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}
