#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long g = gcd(a, b);
  return a * b / g;
}
int main() {
  int N;
  cin >> N;
  long a[N];
  for (int i = 0; i < N; ++i) cin >> a[i];
  long long l = lcm(a[0], a[1]);
  for (int i = 2; i < N; ++i) {
    l = lcm(l, a[i]);
  }
  long long res = 0;
  for (int i = 0; i < N; ++i) res += (l - 1) % a[i];
  cout << res << endl;
  return 0;
}
