#include <bits/stdc++.h>
using namespace std;
using ll = long long;
long gcd(long x, long y) {
  long g = max(x, y);
  long d = min(x, y);
  while (g % d != 0) {
    int z = g % d;
    g = d;
    d = z;
  }
  return d;
}
long lcm(long x, long y) { return x / gcd(x, y) * y; }
int main() {
  long n, a, b;
  cin >> n;
  vector<int> arr(n);
  cin >> a;
  arr[0] = a;
  for (int i = 0; i < (n - 1); ++i) {
    cin >> b;
    arr[i + 1] = b;
    a = lcm(a, b);
  }
  a--;
  int ans = 0;
  for (int i = 0; i < (n); ++i) {
    ans += a % arr[i];
  }
  cout << ans << endl;
}
