#include <bits/stdc++.h>
using namespace std;
void chmin(int &a, int b) {
  if (a > b) a = b;
}
int N;
long long gcd(long long x, long long y) {
  while (y != 0) {
    long long r = x % y;
    x = y;
    y = r;
  }
  return x;
}
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
int main() {
  int l;
  int i = 0, ans = 0;
  int prev;
  cin >> N;
  vector<int> a;
  while (cin >> l) {
    a.push_back(l);
    i++;
    if (i >= N) {
      break;
    }
  }
  prev = a[0];
  for (int i = 1; i < N; i++) {
    int bai = lcm(prev, a[i]);
    prev = bai;
  }
  for (int i = 0; i < N; i++) {
    ans += (prev - 1) % a[i];
  }
  cout << ans << endl;
}
