#include <bits/stdc++.h>
using namespace std;
int main() {
  long N;
  cin >> N;
  long a[N];
  for (long i = 0; i < N; i++) {
    cin >> a[i];
  }
  long max = 0;
  for (long i = 0; i < N; i++) {
    max = std::max(a[i], max);
  }
  long ans = 0;
  long b = max * 2 - 1;
  for (long i = 0; i < N; i++) {
    ans += b % a[i];
  }
  cout << ans << endl;
}
