#include <bits/stdc++.h>
using namespace std;
const int N = 3010;
int n, m, i, j, k;
long long a[N], ans, sum;
long long gcd(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  sum = a[1];
  for (i = 2; i <= n; i++) sum = sum / gcd(sum, a[i]) * a[i];
  for (i = 1; i <= n; i++) ans += (sum - 1) % a[i];
  printf("%lld\n", ans);
  return 0;
}
