#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 10000000;
ll gcd(ll a, ll b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return (a / g) * b;
}
int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll result_lcm = A[0];
  for (int i = 1; i < N; i++) {
    result_lcm = lcm(result_lcm, A[i]);
  }
  ll result = 0;
  for (int i = 0; i < N; i++) {
    result += (result_lcm - 1) % A[i];
  }
  cout << result << endl;
}
