#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m = 1, f = 0;
  cin >> n;
  int a[n], tmp[2];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    tmp[i] = 2;
  }
  for (int i = 0; i < n; i++) {
    while (a[i] % tmp[i] != 0) {
      tmp[i]++;
    }
  }
  for (int i = 0; i < n; i++) {
    m *= tmp[i];
  }
  m = m - 1;
  for (int i = 0; i < n; i++) {
    f += m % a[i];
  }
  cout << f;
}
