#include <bits/stdc++.h>
int gcd(long long a, long long b) { return a % b == 0 ? b : gcd(b, a % b); }
int main() {
  int n;
  long long num[3000], b, sum;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%I64d", &num[i]);
  b = num[0];
  for (int i = 1; i < n; i++) {
    long long c = gcd(b, num[i]);
    b = b * num[i] / c;
  }
  sum = 0;
  for (int i = 0; i < n; i++) {
    sum += (b - 1) % num[i];
  }
  printf("%I64d\n", sum);
  return 0;
}
