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