#include <bits/stdc++.h>
using namespace std;
int gcm(int a, int b) {
  int result = a;
  int k = 0;
  int n = b;
  do {
    k = result % n;
    result = n;
    n = k;
  } while (k != 0);
  return result;
}
int lcm(int a, int b) {
  int g;
  g = gcm(a, b);
  return a * b / g;
}
int main() {
  int N;
  int a[3000];
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
  }
  int maxM = a[0];
  for (int i = 0; i < N; ++i) {
    maxM = abs(lcm(maxM, a[i]));
  }
  maxM -= 1;
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    ans += maxM % a[i];
  }
  cout << ans << endl;
}
