#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
  int r;
  if (x == 0 || y == 0) {
    fprintf(stderr, "引数エラーです。\n");
    return 0;
  }
  while ((r = x % y) != 0) {
    x = y;
    y = r;
  }
  return y;
}
int tes(int x, int y) {
  if (x == 0 || y == 0) {
    fprintf(stderr, "引数エラーです。\n");
    return 0;
  }
  return (x * y / gcd(x, y));
}
int main() {
  int N;
  cin >> N;
  vector<int> a;
  for (size_t i = 0; i < N; i++) {
    int buf;
    cin >> buf;
    a.push_back(buf);
  }
  int l = 1;
  for (size_t i = 0; i < N; i++) {
    l = tes(a[i], l);
  }
  int m = l - 1;
  int f = 0;
  for (size_t i = 0; i < N; i++) {
    f += m % a[i];
  }
  cout << f << endl;
  return 0;
}
