#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)	for(long long int i=a; i<n; i++)
#define loop(i,a,n)	for(long long int i=a; i>=n; i--)
long long int lcm(long long int a,long long int b)	{long long int x=((1ll*a*b)/__gcd(a,b)); return x;}
int main() 
{
	ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(0);
	
	int a;
	cin>>a;
	long long int b[a],ct=0;
	forr(i,0,a)
		cin>>b[i];
	long long int g=lcm(b[0],b[1]);
	forr(i,2,a)
		g=lcm(g,b[i]);
	g--;
	forr(i,0,a)
		ct+=g%b[i];
	cout<<ct;	
	
	return 0;
}
