#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> v;
  long long sum = 1;
  for (int i = 0; i < N; ++i) {
    long long temp;
    cin >> temp;
    sum *= temp;
    v.push_back(temp);
  }
  sort(v.begin(), v.end(), std::greater<int>());
  long long ans = 0;
  for (auto vi : v) {
    ans += (sum - 1) % vi;
  }
  cout << ans << endl;
}
