#include <bits/stdc++.h>
using namespace std;
__attribute__((constructor)) void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main() {
  long long n, a[3001];
  cin >> n;
  for (long long i = (0); i < (n); i++) cin >> a[i];
  long long z = a[0];
  for (long long i = (1); i < (n); i++) {
    long long ta = z, tb = a[i];
    long long aa = a[i];
    if (z < aa) {
      long long tmp = z;
      z = aa;
      aa = tmp;
    }
    long long r = z % aa;
    while (r != 0) {
      z = aa;
      aa = r;
      r = z % aa;
    }
    z = (ta / aa) * tb;
  }
  long long ans = 0;
  z--;
  for (long long i = (0); i < (n); i++) {
    ans += z % a[i];
  }
  cout << ans << endl;
}
