#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int n;
vector<long long> a;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  a.resize(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  long long lcm_val = a[0];
  for (int i = 1; i < (n); ++i) {
    lcm_val = lcm(lcm_val, a[i]);
  }
  long long ans = 0;
  for (int i = 0; i < (n); ++i) {
    ans += (lcm_val - 1) % a[i];
  }
  cout << ans << endl;
  return 0;
}
