#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }
long long lcm(long long number1, long long number2) {
  return number1 * number2 / gcd(number1, number2);
}
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  long long LCM = 1;
  for (int i = 0; i < (int)(N); i++) {
    cin >> a[i];
    LCM = lcm(LCM, a[i]);
  }
  long long ans = 0;
  for (int i = 0; i < (int)(N); i++) {
    ans += (LCM - 1) % a[i];
  }
  cout << ans << endl;
}
