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