#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  while (b) {
    int c = a;
    a = b;
    b = c % b;
  }
  return a;
}
int gongbeishu(int a, int b) {
  int d = gcd(a, b);
  return a * b / d;
}
int main() {
  int n;
  long long x;
  cin >> n;
  int* a = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  x = a[0];
  for (int i = 1; i < n; i++) {
    x = gongbeishu(a[i], x);
  }
  x--;
  int s = 0;
  for (int j = 0; j < n; j++) s += x % a[j];
  cout << s;
  return 0;
}
