#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
long long dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
long long gcd(long long x, long long y) {
  long long r;
  while ((r = x % y) != 0) {
    x = y;
    y = r;
  }
  return y;
}
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return a / g * b;
}
int main() {
  long long n, colcm = 1;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    colcm = lcm(colcm, a[i]);
  }
  colcm--;
  long long ans = 0;
  for (int i = 0; i < n; i++) ans += colcm % a[i];
  cout << ans << endl;
  return 0;
}
