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