#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b != 0) {
    long long r = a % b;
    a = b;
    b = r;
  }
  return a;
}
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long g = 1;
  long long m = 1;
  for (long long i = 0; i < n; i++) {
    g = gcd(g, a[i]);
    m *= a[i];
  }
  long long l = m / g;
  l--;
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    sum += l % a[i];
  }
  cout << sum << endl;
}
