#include <bits/stdc++.h>
using namespace std;
using pii = pair<long long, long long>;
constexpr long long INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr long long mod = 1e9 + 7;
template <class A, class B>
inline bool chmax(A &a, const B &b) {
  return b > a && (a = b, true);
}
template <class A, class B>
inline bool chmin(A &a, const B &b) {
  return b < a && (a = b, true);
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long sum = 0, alllcm = 1;
  vector<long long> a(n);
  for (long long i = 0; i < (n); ++i) {
    cin >> a[i];
    alllcm = lcm(alllcm, a[i]);
  }
  alllcm = alllcm * 2 - 1;
  for (long long i = 0; i < (n); ++i) {
    sum += alllcm % a[i];
  }
  cout << sum << '\n';
  return 0;
}
