#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); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, a, ans = 0, l = 0;
  cin >> n;
  vector<long long> x;
  for (long long i = 0; i < n; i++) {
    cin >> a;
    x.push_back(a);
  }
  l = x[0];
  for (long long i = 0; i < n; i++) {
    l = lcm(l, x[i]);
  }
  for (long long i = 0; i < n; i++) {
    ans += (l - 1) % x[i];
  }
  cout << ans << endl;
  return 0;
}
