#include <bits/stdc++.h>
using namespace std;
typedef struct data {
  int now;
  int cost;
} data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
unsigned long long int N, a[30001];
unsigned long long int gcd(unsigned long long int a, unsigned long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
unsigned long long int lcm(unsigned long long int a, unsigned long long int b) {
  return a * b / gcd(a, b);
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  unsigned long long int cm = lcm(a[0], a[1]);
  for (int i = 2; i < N; i++) {
    cm = lcm(cm, a[i]);
  }
  cm--;
  unsigned long long int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += cm % a[i];
  }
  cout << ans << endl;
  return 0;
}
