#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
int main() {
  int n;
  cin >> n;
  int a[3000];
  for (int i = 0; i < n; i++) cin >> a[i];
  long ans = 1, p;
  for (int i = 0; i < n; i++) {
    p = GCD(a[i], ans);
    ans = ans * a[i] / p;
  }
  long sum = 0;
  for (int i = 0; i < n; i++) {
    sum += (ans - 1) % a[i];
  }
  cout << sum << endl;
}
