#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long int;
using ll = long long;
using pii = pair<int, int>;
ull gcd(ull a, ull b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
ull lcm(ull a, ull b) { return (a * b) / gcd(a, b); }
ll bs(ll s, ll e, ll a[], ll v) {
  ll m = (s + e) / 2;
  if (v > a[m])
    return bs(m + 1, e, a, v);
  else if (v < a[m])
    return bs(s, m - 1, a, v);
  return m;
}
void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
}
void testingio() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
int main() {
  fastio();
  int n;
  cin >> n;
  ull a[n], l = 1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    l = lcm(l, a[i]);
  }
  l--;
  if (l == 0) {
    cout << 0;
  } else {
    ull sum = 0;
    for (int i = 0; i < n; i += 1) {
      sum += l % a[i];
    }
    cout << sum;
  }
  return 0;
}
