#include <bits/stdc++.h>
using namespace std;
long long N, a[3005], GCD, M;
long long LCM, ans;
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }
long long lcm(long long x, long long y) { return x * (y / gcd(x, y)); }
int main(void) {
  scanf("%lld", &N);
  for (long long i = 1; i <= N; i++) scanf("%lld", &a[i]);
  sort(a + 1, a + N + 1);
  LCM = a[1];
  for (long long i = 2; i <= N; i++) {
    LCM = lcm((long long)a[i], LCM);
  }
  LCM--;
  for (long long i = 1; i <= N; i++) ans += (LCM % a[i]);
  printf("%lld", ans);
}
