#include <bits/stdc++.h>
using namespace std;
const long long LINF = 1LL << 60;
const int INF = 1001001001;
const int MOD = 1000000007;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  if (a < b) {
    return gcd(b, a);
  }
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main() {
  int n;
  cin >> n;
  vector<long long> A(n);
  long long value = 1;
  for (int i = 0; i < (n); i++) {
    cin >> A[i];
    value = lcm(value, A[i]);
  }
  value--;
  long long ans = 0;
  for (int i = 0; i < (n); i++) {
    ans += value % A[i];
  }
  cout << ans << endl;
  return 0;
}
