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