#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}

LL add(LL a, LL b) { return a + b; }

int main() {
  int N; cin >> N;
  vector<LL> a(N); cin >> a;
  LL x = a[0];
  for (int i = 0; i < N; ++i) x = lcm(x, a[i]);
  --x;

  LL sum = 0;
  for (int v : a) {
    sum = add(sum, x%v);
  }

  cout << sum << endl;
}
