#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int N;
  vector<long long> A;
  cin >> N;
  long long aa = 1;
  for (int i = 0; i < N; i++) {
    long long a;
    cin >> a;
    A.push_back(a);
    long long bb = gcd(aa, a);
    aa = aa * a / bb;
  }
  long long r = 0;
  for (int i = 0; i < N; i++) {
    r += (aa - 1) % A[i];
  }
  cout << r << endl;
}
