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