#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (a < b) {
    long long int tmp = a;
    a = b;
    b = tmp;
  }
  while (b) {
    long long int tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}
long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
int main() {
  long long int n, s, ans;
  ans = 0;
  s = 1;
  long long int numbers[3010];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> numbers[i];
    if (i > 0) {
      s = lcm(s, numbers[i]);
    } else {
      s = numbers[0];
    }
  }
  for (int i = 0; i < n; i++) {
    ans += (s - 1) % numbers[i];
  }
  cout << ans << endl;
  return 0;
}
