#include <bits/stdc++.h>
using namespace std;
int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = (int)0; i < (int)n; i++) cin >> v[i];
  long long ans, x;
  for (int i = (int)0; i < (int)n; i++) {
    if (!i)
      ans = v[i];
    else {
      ans = lcm(ans, v[i]);
    }
  }
  ans--;
  long long anss = 0;
  for (int i = (int)0; i < (int)n; i++) {
    anss += ans % v[i];
  }
  cout << anss << endl;
}
