#include <bits/stdc++.h>
using namespace std;
int N;
long long a[3100];
long long gcd(long long x, long long y) {
  long long r;
  if (x == 0 || y == 0) {
    return 0;
  }
  while ((r = x % y) != 0) {
    x = y;
    y = r;
  }
  return y;
}
long long lcm(long long x, long long y) {
  if (x == 0 || y == 0) {
    return 0;
  }
  return (x * y / gcd(x, y));
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  long long gcd_n = a[0];
  for (int i = 0; i < N - 1; i++) {
    gcd_n = lcm(gcd_n, a[i + 1]);
  }
  gcd_n--;
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += (gcd_n % a[i]);
  }
  cout << ans << endl;
}
