#include <bits/stdc++.h>
using namespace std;
using pii = pair<long long, long long>;
constexpr long long INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
long long c[5000];
long long n;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
signed main() {
  long long x;
  cin >> n;
  for (long long i = 0; i < (n); ++i) cin >> c[i];
  x = lcm(c[0], c[1]);
  for (long long i = 2; i < n; ++i) {
    x = lcm(x, c[i]);
  }
  x--;
  long long ans = 0;
  for (long long i = 0; i < (n); ++i) ans += x % c[i];
  cout << ans << '\n';
  return 0;
}
