#include <bits/stdc++.h>
using namespace std;
struct edge {
  int to;
  int cost;
};
long long gcd(long long a, long long b) {
  long long r;
  while ((r = a % b) != 0) {
    a = b;
    b = r;
  }
  return b;
}
long long lcm(long long a, long long b) { return (a / gcd(a, b) * b); }
int main(void) {
  int n;
  cin >> n;
  vector<int> a(n);
  long long G = 1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    G = lcm(G, a[i]);
  }
  long long m = G - 1;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += m % a[i];
  }
  cout << ans;
  return 0;
}
