#include <bits/stdc++.h>
using namespace std;
vector<int> adata(4000);
int N;
vector<int> tmpg(4000);
int yukuriddo(int a, int b) {
  int c = a % b;
  return c == 0 ? b : yukuriddo(b, c);
}
int G(int a, int b, int count) {
  int g = (a * b) / yukuriddo(a, b);
  return count == N - 2 ? g : G(g, adata[count + 1], count + 1);
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> adata[i];
  int m = G(adata[0], adata[1], 1) - 1;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += m % adata[i];
  }
  cout << ans << endl;
  return 0;
}
