#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
const ll LINF = 0x1fffffffffffffff;
const int INF = 0x3fffffff;
const int MOD = 1000000007;
void in() {}
template <class T, class... U>
void in(T &t, U &...u) {
  cin >> t;
  in(u...);
}
void solve();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  solve();
}
ll gcd(ll a, ll b) {
  while (a ^= b ^= a ^= b %= a)
    ;
  return b;
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
void solve() {
  int N;
  in(N);
  vector<int> a(N);
  for (auto &x : (a)) in(x);
  ll l = a[0];
  for (int i = (1); i < (N); ++i) {
    l = lcm(l, a[i]);
  }
  l--;
  ll ans = 0;
  for (int i = (0); i < (N); ++i) {
    ans += l % a[i];
  }
  cout << (ans) << endl;
}
