#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;
  int x = 1;
  int ans = 0;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    x = lcm(x, a[i]);
  }
  x = x - 1;
  for (int i = 0; i < N; i++) {
    ans = ans + x % a[i];
  }
  cout << ans << endl;
  return 0;
}
