#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int g[15][15];
const int INF = 1001001001;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
long long lcm(long long x, long long y) {
  if (x == 0 || y == 0) return 0;
  return (x / gcd(x, y) * y);
}
vector<pair<long long, int>> factorize(long long n) {
  vector<pair<long long, int>> res;
  for (long long i = 2; i * i <= n; ++i) {
    if (n % i) continue;
    res.emplace_back(i, 0);
    while (n % i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n, 1);
  return res;
}
int dp[1010][1010];
int bingo[3][3];
bool flag[3][3];
int I[100][20];
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  long long res = 1;
  for (int i = 0; i < n; ++i) {
    res = lcm(res, a[i]);
  }
  res--;
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += (res % a[i]);
  }
  cout << ans << endl;
  return 0;
}
