#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long int ull;

int main(){
    int n;
    scanf("%d",&n);
    ull ans=0,l;
    ull arr[n+5];
    for(int i=0;i<n;i++){
        scanf("%llu",&arr[i]);
        if(i==0) l=arr[0];
        else l = (l*arr[i])/__gcd(arr[i],l);
    }
    for(int i=0;i<n;i++) ans+=((l-1)%arr[i]);
    printf("%llu\n",ans);
    return 0;
}
