#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;
ll N;
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
int main() {
  cin >> N;
  vector<ll> a(N, 0);
  ll lc = 1;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    lc = lcm(lc, a[i]);
  }
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    ans += (2 * lc - 1) % a[i];
  }
  cout << ans << endl;
}
