#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793238463;
const int N = 1010;
const long long INF = 1LL << 60;
template <class T>
void chmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
void chmin(T &a, T b) {
  if (a > b) a = b;
}
unsigned long long int gcd(unsigned long long int x, unsigned long long int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
unsigned long long int lcm(unsigned long long int x, unsigned long long int y) {
  return (x / gcd(x, y)) * y;
}
int main() {
  int n;
  cin >> n;
  vector<long long> v(n), a(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    a[i] = v[i];
  }
  for (int i = 0; i < n - 1; i++) {
    v[i + 1] = lcm(v[i], v[i + 1]);
  }
  v[n - 1]--;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (v[n - 1] % a[i]);
  }
  cout << ans << endl;
}
