#include<bits/stdc++.h>

using namespace std;

inline int read(){
	char ch=getchar();int x=0,f=1;
    while(ch<'0' || ch>'9') {
       if(ch=='-') f=-1;
	  	  ch=getchar();
	}
    while(ch<='9' && ch>='0') {
	   x=x*10+ch-'0';
	   ch=getchar();
	}
    return x*f;
}

int s;
int a[1010101];

int main(){
	int n=read();
	a[1]=read();
	s=a[1];
	for(int i=2;i<=n;i++){
		a[i]=read();
		s=s*a[i]/__gcd(s,a[i]);	
	}
	int sum=0;
	s--;
	for(int i=1;i<=n;i++){
		sum+=s%a[i]; 
	}
	cout<<sum;

	return 0;
}
