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