#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return b;
  }
  gcd(b, a % b);
}
int main() {
  long long n, a[3002], lcm[3002];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  lcm[0] = a[0];
  for (int i = 1; i < n; i++) {
    long long GCD = gcd(max(lcm[i - 1], a[i]), min(lcm[i - 1], a[i]));
    lcm[i] = lcm[i - 1] / GCD * a[i];
  }
  long long A = lcm[n - 1] - 1, ans = 0;
  for (int i = 0; i < n; i++) {
    ans += A % a[i];
  }
  cout << ans;
  return 0;
}
