#include <bits/stdc++.h>
using namespace std;
int 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("%d", &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;
}
