#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};
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 / gcd(a, b) * b; }
const long long MOD = 1e9 + 7;
const long long INF = 1LL << 60;
const int inf = 1 << 31;
int N;
int a[3000];
int main(void) {
  cin >> N;
  for (int i = 0; i < (int)(N); ++i) cin >> a[i];
  sort(a, a + N);
  long long s = 1;
  for (int i = 0; i < N; i++) {
    s = lcm(s, a[i]);
  }
  long long m = s - 1;
  long long f = 0;
  for (int i = 0; i < N; i++) {
    f = f + (m % a[i]);
  }
  cout << f << endl;
  return 0;
}
