#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int dx8[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy8[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
template <class T = long long>
T in() {
  T _in;
  cin >> _in;
  return _in;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  int a[3100];
  cin >> N;
  for (int i = 0; i < N; i++) cin >> a[i];
  long long LCM = a[0];
  for (int i = 1; i < N; i++) {
    LCM = lcm(LCM, a[i]);
  }
  long long M = LCM - 1;
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += M % a[i];
  }
  cout << ans << endl;
  return 0;
}
