#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
  if (x % y == 0) {
    return y;
  } else
    return gcd(y, x % y);
}
int a[3003];
int pm[3003];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  pm[0] = a[0];
  for (int i = 1; i < n; i++) {
    pm[i] = pm[i - 1] * a[i] / gcd(pm[i - 1], a[i]);
  }
  int ans = 0;
  int k = pm[n - 1] - 1;
  for (int i = 0; i < n; i++) ans += k % a[i];
  cout << ans;
  return 0;
}
