#include <bits/stdc++.h>
using namespace std;
const int INTINF = 1e9;
const long long LLINF = 1e18;
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 * b / gcd(a, b); }
void solve() {
  int N;
  cin >> N;
  long long lcm_a = 1;
  vector<long long> A(N);
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    cin >> A[i];
    lcm_a = lcm(lcm_a, A[i]);
  }
  long long ans = 0;
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    ans += (lcm_a - 1) % A[i];
  }
  cout << ans << endl;
}
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(10);
  solve();
  return 0;
}
