#include <bits/stdc++.h>
using namespace std;
int n;
int a[3100];
int lcm(int a, int b) {
  int temp = __algo_gcd(a, b);
  return temp ? (a / temp * b) : 0;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  int g = 1;
  for (int i = 0; i < n; ++i) {
    g = lcm(g, a[i]);
  }
  int m = g - 1;
  int s = 0;
  for (int j = 0; j < n; ++j) {
    s += m % a[j];
  }
  cout << s << endl;
}
