#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; }
long long nlcm(vector<long long> numbers) {
  long long res;
  res = numbers.at(0);
  for (long long i = 1; i < numbers.size(); i++) {
    res = lcm(res, numbers.at(i));
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); i++) cin >> a.at(i);
  long long m = nlcm(a);
  m--;
  long long ans = 0;
  for (int i = 0; i < (n); i++) ans += (m % a[i]);
  cout << ans << endl;
  return 0;
}
