#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int inf = 1e9;
long long num[maxn];
long long pos, last;
long long gcd(long long n, long long m) {
  if (m == 0)
    return n;
  else
    return gcd(m, n % m);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &num[i]);
  pos = num[1] * num[2] / gcd(num[1], num[2]);
  for (int i = 3; i <= n; i++) pos = pos * num[i] / gcd(pos, num[i]);
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans += (pos - 1) % num[i];
  printf("%lld\n", ans);
  return 0;
}
