#include <bits/stdc++.h>
using namespace std;
int N;
template <class T>
inline T gcd(T a, T b) {
  T r;
  if (a < b) swap(a, b);
  while (b > 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
inline T lcm(T a, T b) {
  if (a * b == 0) return 0;
  return a * b / gcd(a, b);
}
int main(void) {
  cin >> N;
  vector<int> a(N);
  long long LCM = 1;
  for (int i = (0); i < (int)(N); ++i) {
    cin >> a[i];
    LCM = lcm(LCM, long long(a[i]));
  }
  long long ans = 0;
  for (int i = (0); i < (int)(N); ++i) {
    ans += (LCM - 1) % a[i];
  }
  cout << ans << endl;
  return 0;
}
