#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b > 0) {
    long long t = a;
    a = b;
    b = t % a;
  }
  return a;
}
long long findlcm(vector<long long> arr) {
  long long ans = arr[0];
  for (int i = 1; i < arr.size(); i++)
    ans = (((arr[i] * ans)) / (gcd(arr[i], ans)));
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
  long long result = findlcm(v);
  if (result > 1) result -= 1;
  long long ans = 0;
  for (int i = 0; i < v.size(); ++i) ans += (result % v[i]);
  cout << ans << endl;
  return 0;
}
