#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool is_int_lround(double x) { return std::lround(x) == x; }
int ketasuu(int x) {
  int n = 0;
  while (x > 0) {
    x /= 10;
    n++;
  }
  return n;
}
ll gcd11(ll x, ll y) {
  long long a = max(x, y), b = min(x, y), c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}
int abs(int x, int y) {
  if (x >= y) {
    return x - y;
  } else if (y > x) {
    return y - x;
  }
}
int fiv(int n) {
  if (n == 0) {
    return 0;
  } else if (n == 1) {
    return 1;
  }
  return fiv(n - 1) + fiv(n - 2);
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  ;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll saba = a[0];
  ;
  for (int i = 0; i < n - 1; i++) {
    saba = (saba * a[i + 1]) / gcd11(saba, a[i + 1]);
  }
  ll ans = 0;
  ;
  for (int i = 0; i < n; i++) {
    ans += (saba - 1) % a[i];
  }
  cout << ans << endl;
}
