#include <bits/stdc++.h>
using namespace std;
const long long MaxN = 3000;
const long long Inf = 1 << 30;
long long num[MaxN + 5];
long long Gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return Gcd(b, a % b);
}
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) scanf("%lld", num + i);
  sort(num + 1, num + 1 + n);
  long long lcm = num[1];
  for (long long i = 2; i <= n; i++) {
    lcm = (num[i] * lcm) / Gcd(num[i], lcm);
  }
  lcm--;
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    ans += lcm % num[i];
  }
  cout << ans << endl;
  return 0;
}
