#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long k) {
  if (k == 0)
    return a;
  else
    return gcd(k, a % k);
}
int main() {
  int n;
  cin >> n;
  long long k, cnt, a, d[3005], s = 0;
  a = cnt = 1;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    cnt = a / gcd(a, d[i]) * d[i];
    a = cnt;
  }
  cnt--;
  for (int i = 0; i < n; i++) s += cnt % d[i];
  cout << s << endl;
}
