#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(int argc, const char* argv[]) {
  int n;
  cin >> n;
  vector<ll> v(n);
  ll x, ans = 1;
  for (int i = 0; i < n; i++) {
    cin >> x;
    v[i] = x;
    ans *= x;
  }
  ll sum1 = 0, sum2 = 0;
  for (int i = 0; i < n; i++) {
    sum1 += (ans + 1) % v[i];
    sum2 += (ans - 1) % v[i];
  }
  if (sum1 > sum2) {
    cout << sum1 << endl;
  } else {
    cout << sum2 << endl;
  }
  return 0;
}
