#include <bits/stdc++.h>
using namespace std;
long long HCF(long long a, long long b) {
  if (a == 0) return b;
  return HCF(b % a, a);
}
long long LCM(long long a, long long b) { return (a * b) / HCF(a, b); }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, x, a[10009];
  cin >> n >> a[0];
  x = a[0];
  for (long i = long(1); i < long(n); i++) {
    cin >> a[i];
    x = LCM(x, a[i]);
  }
  long long p = 0;
  x--;
  for (long i = 0; i < n; i++) p += x % a[i];
  cout << p << "\n";
}
