#include <bits/stdc++.h>
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int lcm(int a, int b) { return a * b / (gcd(a, b)); }
int main() {
  int n;
  scanf("%d", &n);
  int a[n], sum = 0, i, l;
  for (i = 0; i < n; i++) scanf("%lld", &a[i]);
  l = a[0];
  for (i = 0; i < n; i++) l = lcm(l, a[i]);
  l = l - 1;
  for (i = 0; i < n; i++) sum += l % a[i];
  printf("%d", sum);
}
