#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n, m);
  long long lcm = a[0];
  for (int i = 1; i < n; i++) {
    cin >> a[i];
    m = gcd(m, a[i]);
    lcm *= a[i] / m;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (lcm - 1) % a[i];
  }
  cout << ans << endl;
}
