#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<numeric>

using namespace std;

int gcd(long long, long long);

int main(){
    int N;
    cin>>N;
    vector <long long>a(N);
    for(int i=0 ; i<N ; i++){
        cin>>a[i];
    }
    
    long long max = 0;
    long long lc = a[0]*a[1]/gcd(a[0], a[1]);
    for(int i=2 ; i<N ; i++){
        lc = lc*a[i]/gcd(lc, a[i]);
    }
    for(int i=0 ; i<N ; i++){
        max += (lc-1)%a[i];
    }

    cout<<max<<endl;
    
    return 0;
}
int gcd(long long a , long long b)
{
    max = max(a,b);
    min = min(a,b)
    long long r = max%min;
    if (r == 0) return min;
    while (r != 0){
        max = min;
        min = r;
        r = max % min;
    }
	return min;
}