#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>
inline T read(T&x){
	x=0;int f=0;char ch=getchar();
	while (ch<'0'||ch>'9') f|=(ch=='-'),ch=getchar();
	while (ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x=f?-x:x;
}
const int N=1e5+10;
int n,i;
ll lcm,res,a[N];
int main(){
	read(n);
	for (i=1;i<=n;i++){
		read(a[i]);
		if (i==1) lcm=a[i];
		else{
			lcm=lcm/__gcd(a[i],lcm)*a[i];
		}
	}
	lcm--;
	for (i=1;i<=n;i++) res+=lcm%a[i];
	printf("%lld\n",res);
	return 0;
}