#include <bits/stdc++.h>
using namespace std;
int gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int main() {
  int N;
  cin >> N;
  vector<int> v;
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  long long ans = 1;
  for (int i = 0; i <= N - 1; ++i) {
    ans = ans * v[i] / gcd(ans, v[i]);
  }
  ans--;
  int cnt = 0;
  for (int i = 0; i < N; ++i) {
    cnt += ans % v[i];
  }
  cout << cnt << endl;
  return 0;
}
