#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int x, long long int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long int lcm(long long int x, long long int y) {
  long long int g = gcd(x, y);
  return x / g * y;
}
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  long long int a[n], sum = 0, m;
  for (size_t i = 0; i < n; i++) cin >> a[i];
  m = lcm(a[0], a[1]);
  for (size_t i = 2; i < n; i++) m = lcm(m, a[i]);
  m--;
  for (size_t i = 0; i < n; i++) sum += m % a[i];
  cout << sum << endl;
  return 0;
}
