#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000007;
const int mod = 1000000007;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int gcd(int a, int b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
int answer(bool f) {
  if (f)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
int main() {
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < (N); i++) {
    cin >> a[i];
  }
  long long g = gcd(a[0], a[1]);
  long long lcm = a[0] * a[1] / g;
  for (int i = 0; i < (N - 1); i++) {
    g = gcd(a[i + 1], lcm);
    lcm = a[i + 1] * lcm / g;
  }
  long long m = lcm - 1;
  long long ans = 0;
  for (int i = 0; i < (N); i++) ans += m % a[i];
  cout << ans << endl;
}
