#include <bits/stdc++.h>
const int MOD = 1000000007, INF = 1111111111;
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  long long max_m = 1;
  for (int i = 0; i < N; i++) max_m = max_m * a[i] / gcd(max_m, a[i]);
  long long ans = 0;
  for (int i = 0; i < N; i++) ans += (max_m - 1) % a[i];
  cout << ans << "\n";
  return 0;
}
