#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long arr[205000], max2;
int main() {
  int n;
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) scanf("%lld", &arr[i]);
    max2 = 1;
    for (int i = 0; i < n; i++) max2 = lcm(max2, arr[i]);
    max2--;
    long long ans = 0;
    for (int i = 0; i < n; i++) ans += max2 % arr[i];
    cout << ans << endl;
  }
}
