#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
long long gcd(long long x, long long y) {
  if (x % y == 0) return y;
  return gcd(y, x % y);
}
long long LCM(long long a, long long b) { return a * b / gcd(a, b); }
int main(void) {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (int)n; ++i) {
    cin >> a[i];
  }
  long long lcm = a[0];
  for (int i = 1; i < (int)n; ++i) {
    lcm = LCM(lcm, a[i]);
  }
  long long ans = 0;
  lcm--;
  for (int i = 0; i < (int)n; ++i) {
    ans += lcm % a[i];
  }
  cout << ans << endl;
  return 0;
}
