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