#include <bits/stdc++.h>
long long int N, res, ans;
long long int gcd(long long int a, long long int b) {
  if (a < b) std::swap(a, b);
  long long int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
long long int lcm(long long int a, long long int b) {
  return a / gcd(a, b) * b;
}
int main() {
  std::cin >> N;
  std::vector<long long int> a(N);
  for (int i = 0; i < N; ++i) std::cin >> a[i];
  res = 1;
  for (int i = 0; i < N; ++i) {
    res = lcm(res, a[i]);
  }
  --res;
  for (int i = 0; i < N; ++i) ans += res % a[i];
  std::cout << ans << std::endl;
  return 0;
}
