#include <bits/stdc++.h>
using namespace std;
int inf = 1e9;
long long int gcd(long long int a, long long int b) {
  if (a == 0 || b == 0) return 0;
  long long int c;
  while (a != 0) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
long long int lcm(long long int a, long long int b) {
  if (a == 0 || b == 0) return 0;
  return (a / gcd(a, b)) * b;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long int ans = a[0];
  for (int i = 1; i < n; i++) {
    ans = lcm(ans, a[i]);
  }
  cerr << ans << endl;
  long long int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += (ans - 1) % a[i];
  }
  cout << sum << endl;
  return 0;
}
