#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main(int argc, char const *argv[]) {
  ll n, num = 1, ans = 0, a[3100];
  std::cin >> n;
  for (int i = 0; i < n; i++) std::cin >> a[i];
  for (int i = 0; i < n; i++) num = lcm(num, a[i]);
  num--;
  for (int i = 0; i < n; i++) {
    ans += num % a[i];
  }
  std::cout << ans << '\n';
  return 0;
}
