#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long tmp;
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  tmp = a % b;
  while (tmp != 0) {
    a = b;
    b = tmp;
    tmp = a % b;
  }
  return b;
}
int main() {
  long long n;
  vector<long long> a;
  long long tmp_a;
  long long lcd;
  long long ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> tmp_a;
    a.push_back(tmp_a);
  }
  sort(a.begin(), a.end());
  lcd = a[0];
  for (int i = 1; i < n; i++) {
    lcd = lcd * a[i] / gcd(lcd, a[i]);
  }
  lcd--;
  for (int i = 0; i < n; i++) {
    ans += lcd % a[i];
  }
  cout << ans << endl;
}
