#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
int main() {
  int n;
  cin >> n;
  vector<long long> vec(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> vec[i];
  }
  long long x = vec[0];
  for (int i = 1; i < n; ++i) {
    x = lcm(x, vec[i]);
  }
  long long total = 0;
  x--;
  for (int i = 0; i < n; ++i) {
    total += x % vec[i];
  }
  cout << total << endl;
  return 0;
}
