#include <bits/stdc++.h>
using namespace std;
long long N, a[3000 + 10] = {};
long long gcd(long long a, long long b) {
  if (a < b) {
    swap(a, b);
  }
  long long r;
  r = a % b;
  if (r == 0)
    return b;
  else
    return gcd(b, r);
}
signed main() {
  cin >> N;
  for (long long i = 0; i < N; i++) {
    cin >> a[i];
  }
  long long ans = 1;
  for (long long i = 0; i < N; i++) {
    ans = ans * a[i] / gcd(ans, a[i]);
  }
  long long num = 0;
  for (long long i = 0; i < N; i++) {
    num += (ans - 1) % a[i];
  }
  cout << num << endl;
  return 0;
}
