#include <bits/stdc++.h>
using namespace std;
long long a[3010];
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 = 1; i <= n; i++) scanf("%lld", &a[i]);
  long long s = a[1];
  for (int i = 2; i <= n; i++) {
    long long gcd = Gcd(s, a[i]);
    s = s / gcd * a[i];
  }
  s--;
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += s % a[i];
  }
  printf("%lld\n", sum);
  return 0;
}
