#include <bits/stdc++.h>
const int MOD = (int)1e9 + 7;
using namespace std;
int gcd(int a, int b) {
  while (b) {
    int tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
  int n, tmp, ans = 0;
  cin >> n;
  vector<int> s(n);
  for (int i = 0; i < (n); i++) cin >> s.at(i);
  tmp = lcm(s.at(0), s.at(1));
  for (int i = 0; i < (n - 2); i++) tmp = lcm(tmp, s.at(i));
  for (int i = 0; i < (n); i++) ans = ans + ((tmp + 1) % s.at(i));
  cout << ans << endl;
}
