#include <bits/stdc++.h>
using namespace std;
int dx[8] = {0, 0, -1, 1, 1, 1, -1, -1};
int dy[8] = {-1, 1, 0, 0, 1, -1, 1, -1};
const int SIZE = 1050;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main() {
  vector<int> A;
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A.push_back(a);
  }
  long long L = A[0];
  for (int i = 1; i < N; i++) L = lcm(L, A[i]);
  L--;
  int ans = 0;
  for (int i = 0; i < N; i++) ans += L % (A[i]);
  cout << ans << endl;
  return 0;
}
