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