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