#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int lcm(long long int m, long long int n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
unsigned long long int n;
vector<unsigned long long int> a;
unsigned long long int f(unsigned long long int m) {
  unsigned long long int sum = 0;
  for (int i = 0; i < (int)(n); i++) {
    sum += m % a[i];
  }
  return sum;
}
int main() {
  cin >> n;
  a.reserve(n);
  long long int l = 1;
  for (int i = 0; i < (int)(n); i++) {
    unsigned long long int an;
    cin >> an;
    a.push_back(an);
    l = lcm(l, an);
  }
  cout << f(l - 1) << endl;
  return 0;
}
