#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  long long r;
  while ((r = x % y) != 0) {
    x = y;
    y = r;
  }
  return y;
}
long long get_lcm(long long x, long long y) { return (x * y / gcd(x, y)); }
int main() {
  int n = 0;
  std::cin >> n;
  int a;
  long long ans, lcm;
  ans = 0;
  lcm = 1;
  vector<int> v;
  for (int i = 0; i < n; ++i) {
    std::cin >> a;
    lcm = get_lcm(lcm, a);
    v.push_back(a);
  }
  for (int i = 0; i < n; ++i) {
    ans += (lcm - 1) % v[i];
  }
  std::cout << ans << endl;
}
