#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll now = a[0];
  rep(i, n) now = now * a[i] / __gcd(now, a[i]);
  ll total = 0;
  rep(i, n) total += (now - 1) % a[i];
  cout << total << endl;
}