#include <bits/stdc++.h>
using namespace std;
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
unsigned long long lcm(unsigned long long a, unsigned long long b) {
  return a / gcd(a, b) * b;
}
int main() {
  int n;
  cin >> n;
  unsigned long long tmp = 0, ans = 0;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    if (i == 0) tmp = a.at(i);
    tmp = lcm(tmp, a.at(i));
  }
  tmp -= 1;
  for (int i = 0; i < n; i++) {
    ans += tmp % a.at(i);
  }
  cout << ans << endl;
  return 0;
}
