#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return a / g * b;
}
int main() {
  int n;
  cin >> n;
  vector<int> v(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  long long lcmVal = v[0];
  for (int i = 1; i < n; i++) {
    lcmVal = lcm(lcmVal, v[i]);
  }
  lcmVal--;
  long long res = 0;
  for (int i = 0; i < n; i++) {
    res += lcmVal % v[i];
  }
  cout << res << endl;
}
