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