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