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