#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
using namespace std;
const int N = 1e6 + 5;
const ll inf = -1e18;
const int MOD = 1e9 + 7;


ll a[N];
int main(){
   fast;
   ll n, lcm, sum = 0;
   cin >> n;
   for(int i = 1; i <= n; i++){
   	cin >> a[i];
   }
   lcm = a[1];
   for(int i = 2; i <= n; i++){
   	lcm = a[i] * lcm / __gcd(a[i], lcm);
   }
   lcm--;
   for(int i = 1; i <= n; i++)
   	sum += lcm % a[i];
   cout << sum;




   return 0;
} 