#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    vector<long long int> a(n);
    long long int gcd = 0, prod = 1;
    for (long long int i = 0; i < n; ++i) {
      cin >> a[i];
      prod = prod * a[i];
    }
    long long int ans = n;
    prod--;
    long long int f = 0;
    for (auto x : a) f += prod % x;
    ans = max(ans, f);
    cout << ans;
  }
}
