#include <bits/stdc++.h>
using namespace std;
unsigned long int G_C_D(unsigned long int a, unsigned long int b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  while (b != 0) {
    a %= b;
    if (a == 0) return b;
    b %= a;
  }
  return a;
}
unsigned long int G_C_D(int list[], int size) {
  unsigned long int a = list[0];
  for (size_t i = 1; i < size; ++i) {
    a = G_C_D(a, list[i]);
  }
  return a;
}
unsigned long int L_C_M(unsigned long int a, unsigned long int b) {
  if (a == 0 && b == 0) return 0;
  return a / G_C_D(a, b) * b;
}
unsigned long int L_C_M(int list[], int size) {
  unsigned long int a = list[0];
  for (size_t i = 1; i < size; ++i) {
    a = L_C_M(a, list[i]);
  }
  return a;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m = 0;
  unsigned long int f = 0;
  unsigned long int x;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  x = L_C_M(a, n);
  for (int i = 0; i < n; i++) {
    f += (x - 1) % a[i];
  }
  cout << f;
  return 0;
}
