#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long tmp = 1;
  for (long long i = (0); i < (n); i++) {
    cin >> a[i];
    tmp = lcm(tmp, a[i]);
  }
  tmp--;
  long long ans = 0;
  for (long long i = (0); i < (n); i++) ans += (tmp % a[i]);
  cout << ans << endl;
  return 0;
}
