#include <bits/stdc++.h>
using ll = long long;
using namespace std;
struct aaa {
  aaa() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} aaaaaaa;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return (a * b) / gcd(a, b); }
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
ll N, g = 1;
int main() {
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < (N); ++i) {
    cin >> a[i];
    g = lcm(g, a[i]);
  }
  ll ans = 0;
  for (int i = 0; i < (N); ++i) ans += (g - 1) % a[i];
  cout << ans << endl;
}
