#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
int main() {
  ll n, tmp, ans = 0;
  cin >> n;
  vll a(n);
  cin >> a[0];
  tmp = a[0];
  for (long i = 1; i < n; i++) {
    cin >> a[i];
    tmp = lcm(tmp, a[i]);
  }
  tmp--;
  for (long i = 0; i < n; i++) {
    ans += tmp % a[i];
  }
  cout << ans << '\n';
  return 0;
}
