#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int num1, long long int num2) {
  return num2 != 0 ? gcd(num2, num1 % num2) : num1;
}
long long int lcm(long long int num1, long long int num2) {
  return num1 / gcd(num1, num2) * num2;
}
int main() {
  long long int A, B, C = 999999999, D = 0, E = 0, F = 0, G = 0, H = 0, N, M;
  cin >> N;
  vector<long long int> P(N), Q(N);
  for (long long int i = 0; i < N; i++) {
    cin >> P[i];
    Q[i] = P[i];
  }
  for (long long int i = 1; i < N; i++) Q[i] = lcm(Q[i], Q[i - 1]);
  A = Q[N - 1] - 1;
  for (long long int i = 0; i < N; i++) D += A % P[i];
  cout << D << endl;
}
