#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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 * B / gcd(A, B); }
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  long long LCM = 1;
  for (long long int i = 0; i < n; i++) {
    LCM = lcm(a[i], LCM);
  }
  long long ans = 0;
  for (long long int i = 0; i < n; i++) {
    ans += (LCM - 1) % a[i];
  }
  cout << ans << endl;
}
