#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int long long MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);
int long long gcd(int long long a, int long long b) {
  if (a == 0 || b == 0) return max(a, b);
  if (b > a) swap(a, b);
  while (1) {
    if (a % b != 0) {
      int long long tmp = b;
      b = a % b;
      a = tmp;
    } else {
      return b;
    }
  }
}
int main() {
  int long long n;
  cin >> n;
  vector<int long long> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int long long m = v[0];
  for (int i = 1; i < n; i++) {
    int long long k = gcd(m, v[i]);
    m = m * v[i] / k;
  }
  m--;
  int long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += m % v[i];
  }
  cout << ans << endl;
  return 0;
}
