#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
long long koubai(long long a, long long b) { return (a / gcd(a, b) * b); }
int main() {
  long long n;
  cin >> n;
  vector<long long> num(n);
  cin >> num[0];
  long long mae = num[0];
  for (int i = 1; i < n; i++) {
    cin >> num[i];
    mae = koubai(mae, num[i]);
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (mae - 1) % num[i];
  }
  cout << ans << endl;
  return 0;
}
