#include <bits/stdc++.h>
using namespace std;
template <class A>
void pr(A a) {
  cout << (a) << endl;
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << " ";
  pr(b);
}
template <class A, class B, class C>
void pr(A a, B b, C c) {
  cout << a << " ";
  pr(b, c);
}
template <class A, class B, class C, class D>
void pr(A a, B b, C c, D d) {
  cout << a << " ";
  pr(b, c, d);
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main(void) {
  int n;
  cin >> n;
  long long ml = 0;
  vector<long long> a(n);
  for (int i = 0; i < int(n); ++i) {
    cin >> a[i];
    if (i)
      ml = lcm(a[i], ml);
    else
      ml = a[i];
  }
  long long ans = 0;
  for (int i = 0; i < int(n); ++i) {
    ans += (ml - 1) % a[i];
  }
  pr(ans);
}
