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