#include <bits/stdc++.h>
using namespace std;
bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
  return arg1.first > arg2.first;
}
template <class T>
void chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
}
template <class T>
void chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
}
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
long long lcm(long long a, long long b) { return (a * b / gcd(a, b)); }
int main(void) {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int in = 0; in < n; in++) {
    cin >> a.at(in);
  }
  long long L = a.at(0);
  for (int in = 1; in < n; in++) {
    L = lcm(L, a.at(in));
  }
  L -= 1;
  long long ans = 0;
  for (int in = 0; in < n; in++) {
    ans += L % a.at(in);
  }
  cout << ans << endl;
  return 0;
}
