#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
template <typename T>
void cmax(T &a, T b) {
  a = max(a, b);
}
template <typename T>
void cmin(T &a, T b) {
  a = min(a, b);
}
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long c, long long d) {
  long long e = gcd(c, d);
  return c / e * d;
}
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) cin >> a[i];
  long long LCM = a[0];
  for (long long i = (1); i < (n); i++) {
    LCM = lcm(LCM, a[i]);
  }
  long long ans = 0;
  for (long long i = 0; i < (n); i++) ans += (LCM - 1) % a[i];
  cout << ans << endl;
  return 0;
}
