#include <bits/stdc++.h>
using namespace std;
struct Vec {
  int ind;
  int val;
};
bool valDesc(const Vec& left, const Vec& right) {
  return left.val == right.val ? left.val > right.val : left.val > right.val;
}
bool valAsc(const Vec& left, const Vec& right) {
  return left.val == right.val ? left.val < right.val : left.val < right.val;
}
long gcd(long x, long y) {
  long r;
  if (x == 0 || y == 0) {
    fprintf(stderr, "err\n");
    return 0;
  }
  while ((r = x % y) != 0) {
    x = y;
    y = r;
  }
  return y;
}
long lcm(long x, long y) {
  if (x == 0 || y == 0) {
    fprintf(stderr, "err\n");
    return 0;
  }
  return (x * y / gcd(x, y));
}
int main(void) {
  int N;
  long a, b, ans = 0;
  cin >> N;
  vector<long> c(N);
  scanf("%ld", &a);
  c[0] = a;
  for (int i = 1; i < N; i++) {
    scanf("%ld", &c[i]);
    a = lcm(a, c[i]);
  }
  for (int i = 0; i < N; i++) ans += (a - (long)1) % c[i];
  printf("%ld\n", ans);
  fflush(stdout);
  return 0;
}
