#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
constexpr int64_t INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int64_t mod1 = 1000000007;
constexpr int64_t mod2 = 998244353;
constexpr int64_t dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int64_t dy[] = {0, -1, 0, 1, 1, -1, -1, 1};
template <class A, class B>
inline bool chmax(A &a, const B &b) {
  return b > a && (a = b, true);
}
template <class A, class B>
inline bool chmin(A &a, const B &b) {
  return b < a && (a = b, true);
}
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T> >;
template <class T>
using max_heap = priority_queue<T>;
template <class T, class U>
using umap = unordered_map<T, U>;
inline int64_t updiv(int64_t n, int64_t d) { return ((n + d - 1) / d); }
inline int64_t square(int64_t a) { return a * a; }
int64_t gcd(int64_t a, int64_t b) { return b ? gcd(b, a % b) : a; }
int64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; }
signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int64_t n, m = 1;
  cin >> n;
  vector<int64_t> a(n);
  for (int64_t i = 0; i < (n); ++i) {
    cin >> a[i];
    m = lcm(a[i], m);
  }
  int64_t res = 0;
  --m;
  for (int64_t i = 0; i < (n); ++i) {
    res += m % a[i];
  }
  cout << res << '\n';
  return 0;
}
