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