#include <bits/stdc++.h>
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main(int argc, char** argv) {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);
  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);
  int N;
  long long a[3333], lcm = 1, gcd;
  std::cin >> N;
  for (int i = 0; i < N; i++) {
    std::cin >> a[i];
    lcm *= a[i];
    gcd = i == 0 ? a[i] : ::gcd(a[i], gcd);
  }
  long long m = lcm / gcd - 1, f = 0;
  for (int i = 0; i < N; i++) f += m % a[i];
  std::cout << f << std::endl;
  return 0;
}
