#include <bits/stdc++.h>
using namespace std;
long long n, a[4010], s, ans, flag = 0;
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int main(void) {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  s = a[0];
  for (long long i = 1; i < n; i++) {
    long long x = gcd(s, a[i]);
    s = s / x * a[i];
  }
  s--;
  for (long long i = 0; i < n; i++) ans += s % a[i];
  cout << ans << endl;
}
