#include <bits/stdc++.h>
using namespace std;
int rec(int a, int b) {
  if (b == 0) return a;
  return rec(b, a % b);
}
int LCM(int a, int b) {
  int gcm = rec(a, b);
  return a * b / gcm;
}
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  int lcm = a[0];
  for (int i = 1; i < N; i++) {
    lcm = LCM(lcm, a[i]);
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += (lcm - 1) % a[i];
  }
  cout << ans << endl;
}
