#include <bits/stdc++.h>
using namespace std;
int gcd(int m, int n) {
  if ((0 == m) || (0 == n)) return 0;
  while (m != n) {
    if (m > n)
      m = m - n;
    else
      n = n - m;
  }
  return m;
}
int lcm(int m, int n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int res = 0;
  int x = a[0];
  for (int i = 1; i < n; i++) {
    int tmp = lcm(x, a[i]);
    x = tmp;
  }
  int m = x - 1;
  for (int i = 0; i < n; i++) {
    res += m % a[i];
  }
  cout << res << endl;
  return 0;
}
