#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int x, long long int y) {
  return y == 0 ? x : gcd(y, x % y);
}
long long int lcm(long long int x, long long int y) {
  return x * y / gcd(x, y);
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int A = a[0];
  for (long long int i = 0; i < n; i++) {
    A = lcm(A, a[i]);
  }
  A--;
  int f = 0;
  for (long long int i = 0; i < n; i++) {
    f += A % a[i];
  }
  cout << f << endl;
  return 0;
}
