#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
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() {
  ios_base::sync_with_stdio(false);
  long long b, c, n, k = 0;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<long long> v = a;
  sort((a).begin(), (a).end());
  for (int i = 0; i < n - 1; i++) v[i + 1] = lcm(v[i], v[i + 1]);
  v[n - 1]--;
  for (int i = 0; i < n; i++) k += v[n - 1] % a[i];
  cout << k << endl;
  return 0;
}
