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