#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 3002;
int N;
int a[MAX_N];
int gcd(int x, int y) {
  if (x % y == 0) return y;
  return gcd(y, x % y);
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> a[i];
  int a_lcs = 1;
  for (int i = 0; i < N; i++) {
    a_lcs = lcm(a[i], a_lcs);
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += a[i] % a_lcs;
  }
  ans -= N;
  cout << ans << endl;
}
