#include <bits/stdc++.h>
using namespace std;
const long long INF = ((1LL << 30) + (1LL << 29));
const long long MOD = 1000000007;
long long N;
vector<long long> A;
void input() {
  cin >> N;
  A.resize(N);
  for (long long i = 0; i < (long long)(N); ++i) {
    cin >> A[i];
  }
}
void solve() {
  sort(A.rbegin(), A.rend());
  long long i = 1;
  for (auto x : A) {
    i *= x;
  }
  i--;
  long long ans = 0;
  for (long long j = 0; j < N; ++j) {
    ans += i % A[j];
  }
  cout << ans << endl;
}
signed main() {
  input();
  solve();
  return 0;
}
