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