#include <bits/stdc++.h>
using namespace std;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
using ll = long long;
using ld = long double;
using ull = unsigned long long;
const int PI = acos(-1);
const int INF = numeric_limits<int>::infinity() / 2;
const ll INFLL = numeric_limits<ll>::infinity() / 2;
ull gcd(ll a, ull b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<ull> A(N);
  for (int i = (0); i < (N); ++(i)) cin >> A[i];
  ull m = A[0];
  for (int i = (1); i < (N); ++(i)) m = lcm(m, A[i]);
  m--;
  ull ans = 0;
  for (int i = (0); i < (N); ++(i)) ans += (m % A[i]);
  cout << ans << endl;
  return 0;
}
