#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);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; ++i) cin >> a[i];
  long long cur = a[0];
  for (int i = 1; i < N; ++i) cur = lcm(cur, a[i]);
  long long res = 0;
  --cur;
  for (int i = 0; i < N; i++) {
    res += cur % a[i];
  }
  cout << res << endl;
}
