#include <bits/stdc++.h>
using namespace std;
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 x, long long y) { return (x * y / gcd(x, y)); }
int main() {
  int N;
  cin >> N;
  vector<long long> a(N);
  for (int j = 0; j < N; ++j) {
    cin >> a[j];
  }
  long long alcm = a[0];
  for (int j = 1; j < N; ++j) {
    alcm = lcm(alcm, a[j]);
  }
  alcm -= 1;
  long long fmax = 0;
  for (int j = 0; j < N; ++j) {
    fmax += (alcm % a[j]);
  }
  cout << fmax << endl;
}
