#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T x, T y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
template <typename T>
T lcm(T x, T y) {
  if (x == 0 || y == 0) return 0;
  return x / gcd(x, y) * y;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
vector<int> p;
vector<int> r;
void init(int n) {
  p.reserve(n);
  r.reserve(n);
  for (int i = 0; i < n; i++) {
    p[i] = i;
    r[i] = 0;
  }
}
int root(int x) { return p[x] == x ? x : p[x] = root(p[x]); }
bool same(int x, int y) { return root(x) == root(y); }
void unite(int x, int y) {
  x = root(x);
  y = root(y);
  if (x == y) return;
  if (r[x] < r[y])
    p[x] = y;
  else {
    p[y] = x;
    if (r[x] == r[y]) r[x]++;
  }
}
int main() {
  int N;
  cin >> N;
  vector<long> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  long tmp = a[0];
  for (int i = 1; i < N; i++) {
    tmp = lcm(tmp, a[i]);
  }
  long A = 0;
  for (int i = 0; i < N; i++) {
    A += (tmp - 1) % a[i];
  }
  cout << A << endl;
}
