#include "bits/stdc++.h"
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;
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);
  forn(i, 0, n) {
    scanf(" %d", &a[i]);
    mx = max(a[i], mx);
  }
}

void solve() {
  ll ans = 0;
  ll g = a[0];
  forn(i, 1, n) {
    g = lcm(g, a[i]);
  }
  g--;
  forn(j, 0, n) {
    ans += (g % a[j]);
  }
  printf("%lld\n", ans);
}

int main() {
#ifdef DEBUG
  freopen("input", "r", stdin);
  //  freopen("output", "w", stdout);
  //  gen();
#endif
  input();
  solve();
  return 0;
}
