#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) FOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

const double eps = 1e-10;
const int MOD = 1000000007;

void printv(vector<auto> const& s) {
  REP(i, s.size()) {
    cout << s[i] << endl;
  }
}

ll gcd(ll a, ll b) {
  if(b == 0) {
    return a;
  } else {
    return gcd(b, a%b);
  }
}

ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  int n; cin >> n;
  vector<ll> a(n);
  REP(i, n) {
    cin >> a[i];
  }

  ll m = 1;
  REP(i, n) {
    m = lcm(m, a[i]);
  }
  m--;
  ll ans = 0;
  REP(i, n) {
    ans += m % a[i];
  }

  cout << ans << endl;
  
  
}
