#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using Graphl = vector<vector<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;
}
template <class T>
void PrintVector(const vector<T>& vec) {
  for (auto val : vec) cout << val << " ";
  cout << endl;
}
const long long INF = 1LL << 60;
const long long minusINF = -(1LL << 40);
const int MOD = 1000000007;
const double PI = acos(-1);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
long long GCD(long long a, long long b) { return b ? GCD(b, a % b) : a; }
long long LCM(long long a, long long b) { return a = a / GCD(a, b) * b; }
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  long long lcm = 1;
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
    lcm = LCM(lcm, a[i]);
  }
  lcm--;
  long long ans = 0;
  for (int i = 0; i < (int)(n); i++) {
    ans += lcm % a[i];
  }
  cout << ans << endl;
}
