#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main(void) {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long lcm_a = 1;
  for (int i = 0; i < n; i++) {
    lcm_a = lcm(lcm_a, a[i]);
  }
  long long m = lcm_a - 1;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (m % a[i]);
  }
  cout << ans << endl;
  return 0;
}
