#include <bits/stdc++.h>
using namespace std;
long long g(long long a, long long b) {
  long long c = a * b;
  if (a < b) swap(a, b);
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return c / b;
}
int main(void) {
  long long x, n, i, ans = 0;
  cin >> n;
  long long a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  x = a[0];
  for (i = 1; i < n; i++) {
    x = g(x, a[i]);
  }
  x--;
  for (i = 0; i < n; i++) {
    ans += x % a[i];
  }
  cout << ans << endl;
}
