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