#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
long long gcd_ori(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) {
    return a;
  }
  return gcd_ori(b, a % b);
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  sort(a.begin(), a.end());
  long long ans = 0;
  long long tmp = 1;
  long long tmp2 = a.at(0);
  for (int i = 0; i < n; i++) {
    long long tmp3 = tmp2 * a.at(i);
    tmp = gcd_ori(tmp2, a.at(i));
    tmp3 /= tmp;
    tmp2 = tmp3;
  }
  tmp2--;
  for (int i = 0; i < n; i++) {
    ans += tmp2 % a.at(i);
  }
  cout << ans << endl;
  return 0;
}
