#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e3 + 10;
int n;
long long a[maxn];
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
long long lcm(long long x, long long y) { return x * y / gcd(x, y); }
int main() {
  while (cin >> n) {
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    long long num = a[0];
    for (int i = 1; i < n; ++i) {
      num = lcm(num, a[i]);
    }
    long long ans = 0;
    num -= 1;
    for (int i = 0; i < n; ++i) {
      ans += num % a[i];
    }
    cout << ans << endl;
  }
  return 0;
}
