#include <bits/stdc++.h>
template <class Type>
struct IN : Type {
  IN() { std::cin >> *this; }
};
template <class Type>
struct IN_ {
  Type val;
  IN_() { std::cin >> val; }
  operator Type&() { return val; }
  IN_<Type>& operator=(const Type& _value) {
    val = _value;
    return *this;
  }
};
template <class Char, class Type>
std::basic_ostream<Char>& operator<<(std::basic_ostream<Char>& os,
                                     const IN_<Type>& value) {
  return os << value.val;
}
template <class Char, class Type>
std::basic_istream<Char>& operator>>(std::basic_istream<Char>& is,
                                     IN_<Type>& value) {
  return is >> value.val;
}
template <class Type>
void OUT(const Type& value) {
  std::cout << value << std::endl;
}
template <class Type, class... Args>
void OUT(const Type& value, const Args&... args) {
  std::cout << value << ' ';
  OUT(args...);
}
void YESNO(const bool cond) { OUT(cond ? "YES" : "NO"); }
void YesNo(const bool cond) { OUT(cond ? "Yes" : "No"); }
using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;
ll factorial(ll n) {
  for (ll i = n - 1; i > 1; --i) n *= i;
  return n;
}
ll ncr(const ll n, ll r) {
  if (r * 2 > n) r = n - r;
  ll dividend = 1, divisor = 1;
  for (ll i = 1; i <= r; ++i) {
    dividend *= n - i + 1;
    divisor *= i;
  }
  return dividend / divisor;
}
bool isprime(const ll num) {
  if (num < 2) return false;
  if (num == 2) return true;
  if (num % 2 == 0) return false;
  double sqrtNum = sqrt(num);
  for (ll i = 3; i <= sqrtNum; i += 2) {
    if (num % i == 0) return false;
  }
  return true;
}
ll digsum(ll n) {
  ll sum = 0;
  while (n != 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
void Main();
int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  Main();
  return 0;
}
using namespace std;
ll gcd(ll a, ll b) {
  for (;;) {
    if (a == 0) return b;
    b %= a;
    if (b == 0) return a;
    a %= b;
  }
}
ll lcm(ll a, ll b) {
  ll temp = gcd(a, b);
  return temp ? (a / temp * b) : 0;
}
void Main() {
  inll n;
  vll a;
  for (ll(i) = 0; (i) < (n); ++(i)) {
    inll a_;
    a.push_back(a_);
  }
  ll m = accumulate(a.begin(), a.end(), 1, lcm) - 1;
  ll sum = 0;
  for (ll(i) = 0; (i) < (n); ++(i)) {
    sum += m % a[i];
  }
  return OUT(sum);
}
