#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
  int N;
  cin >> N;
  ll all_lcm = 1;
  ll a[3000];
  for (int i = 0; i < (N); i++) {
    cin >> a[i];
    all_lcm = lcm(all_lcm, a[i]);
  }
  all_lcm -= 1;
  ll ans = 0;
  for (int i = 0; i < (N); i++) {
    ans += (all_lcm % a[i]);
  }
  cout << ans;
  system("pause");
  return 0;
}
