#include <bits/stdc++.h>
using namespace std;
template <typename... Args>
void dbg(Args&&... args) {
  using expander = int[];
  (void)expander{
      0,
      (static_cast<void>(void(cout << std::forward<Args>(args) << " ")), 0)...};
  cout << endl;
}
void gen() { exit(0); }
const int N = 3004;
int n;
int a[N];
int mx = 0;
void input() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf(" %d", &a[i]);
    mx = max(a[i], mx);
  }
}
long long GCD(long long u, long long v) {
  while (v != 0) {
    long long r = u % v;
    u = v;
    v = r;
  }
  return u;
}
long long l(long long a, long long b) {
  long long g = GCD(a, b);
  return (a * b) / g;
}
void solve() {
  long long ans = 0;
  long long g = a[0];
  for (int i = 1; i < n; i++) {
    g = l(g, (long long)a[i]);
  }
  g--;
  for (int j = 0; j < n; j++) {
    ans += (g % a[j]);
  }
  printf("%lld\n", ans);
}
int main() {
  input();
  solve();
  return 0;
}
