#include <bits/stdc++.h>
using namespace std;
unsigned long long int LCM(int arr[], int n) {
  int max_num = 0;
  for (int i = 0; i < n; i++)
    if (max_num < arr[i]) max_num = arr[i];
  unsigned long long int res = 1;
  int x = 2;
  while (x <= max_num) {
    vector<int> indexes;
    for (int j = 0; j < n; j++)
      if (arr[j] % x == 0) indexes.push_back(j);
    if (indexes.size() >= 2) {
      for (int j = 0; j < indexes.size(); j++)
        arr[indexes[j]] = arr[indexes[j]] / x;
      res = res * x;
    } else
      x++;
  }
  for (int i = 0; i < n; i++) res = res * arr[i];
  return res;
}
int main() {
  int N;
  cin >> N;
  int arr[N], may[N];
  for (int i = 0; i < N; ++i) {
    cin >> arr[i];
    may[i] = arr[i];
  }
  unsigned long long int b = LCM(arr, N);
  unsigned long long int res = 0;
  for (int j = 0; j < N; ++j) {
    res += (b - 1) % may[j];
  }
  cout << res;
}
