#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
const long long int MAX = 9000000000000000000;
const long long int MIN = -9000000000000000000;
const long double DMAX = 4500;
const long double DMIN = -4500;
const int INF = INT_MAX;
const long long int LLINF = 1LL << 60;
const long long int MOD = 1000000007;
const long double EPS = 1e-9;
long long int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
long long int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <typename T>
T Sum(vector<T> n, long long int a = 0, long long int b = 0) {
  if (b == 0) {
    return (accumulate(n.begin() + a, n.end(), 0));
  } else {
    return (accumulate(n.begin() + a, n.begin() + b, 0));
  }
}
template <>
long double Sum(vector<long double> n, long long int a, long long int b) {
  if (b == 0) {
    return (accumulate(n.begin() + a, n.end(), 0));
  } else {
    return (accumulate(n.begin() + a, n.begin() + b, 0));
  }
}
template <typename T>
void Sort(T &n, long long int a = 0, long long int b = 0) {
  if (b == 0) {
    return (sort(n.begin() + a, n.end()));
  } else {
    return (sort(n.begin() + a, n.begin() + b));
  }
}
template <typename T>
void Reve(T &n, long long int a = 0, long long int b = 0) {
  if (b == 0) {
    return (reverse(n.begin() + a, n.end()));
  } else {
    return (reverse(n.begin() + a, n.begin() + b));
  }
}
template <typename T, typename U>
void Copy(T &n, U &m, long long int a = 0, long long int b = 0) {
  copy(n.begin(), n.end(), m.begin());
}
template <typename T>
long double Cast(T &n) {
  return static_cast<long double>(n);
}
template <typename T>
void V(T &n) {
  for (long long int i = 0; i < n.size(); i++) {
    cin >> n[i];
  }
}
template <typename T, typename U>
void V2(T &n, U &m) {
  for (long long int i = 0; i < n.size(); i++) {
    cin >> n[i] >> m[i];
  }
}
template <typename T, typename U, typename W>
void V3(T &n, U &m, W &p) {
  for (long long int i = 0; i < n.size(); i++) {
    cin >> n[i] >> m[i] >> p[i];
  }
}
void yn(bool a) {
  if (a)
    cout << "yes" << endl;
  else
    cout << "no" << endl;
}
void Yn(bool a) {
  if (a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
void YN(bool a) {
  if (a)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
void fyn(bool a) {
  if (a)
    cout << "yes" << endl;
  else
    cout << "no" << endl;
  exit(0);
}
void fYn(bool a) {
  if (a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  exit(0);
}
void fYN(bool a) {
  if (a)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  exit(0);
}
void AC(bool a) {
  if (a)
    cout << "AC" << endl;
  else
    cout << "WA" << endl;
}
void fAC(bool a) {
  if (a)
    cout << "AC" << endl;
  else
    cout << "WA" << endl;
  exit(0);
}
void fnone(void) {
  cout << "None" << endl;
  exit(0);
}
void fOdd(bool a) {
  if (a)
    cout << "Odd" << endl;
  else
    cout << "Even" << endl;
  exit(0);
}
void Possible(bool a) {
  if (a)
    cout << "Possible" << endl;
  else
    cout << "Impossible" << endl;
  exit(0);
}
void POSSIBLE(bool a) {
  if (a)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  exit(0);
}
void square(char a, long long int h, long long int w) {
  for (long long int i = 0; i < h; i++) {
    for (long long int j = 0; j < w; j++) {
      cout << a;
    }
    cout << endl;
  }
}
void yoke(char a, char b, long long int h, long long int w) {
  for (long long int i = 0; i < h; i++) {
    for (long long int j = 0; j < w; j++) {
      if (i == 0 || i == h - 1)
        cout << a;
      else if (j == 0 || j == w - 1)
        cout << a;
      else
        cout << b;
    }
    cout << endl;
  }
}
long long int C45(long long int n) { return (n + 1) / 2; }
long long int stcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}
bool IsPrime(long long int num) {
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  long double sqrtNum = sqrt(num);
  for (long long int i = 3; i <= sqrtNum; i += 2) {
    if (num % i == 0) return false;
  }
  return true;
}
long long int GetDigit(long long int num) { return log10(num) + 1; }
long long int KSum(long long int n) {
  long long int sum = 0;
  if (n < 0) return 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
bool KReve(long long int n) {
  int reverse = 0;
  int remaind;
  int tmp = n;
  while (tmp != 0) {
    remaind = tmp % 10;
    reverse = reverse * 10 + remaind;
    tmp /= 10;
  }
  if (reverse == n)
    return true;
  else
    return false;
}
vector<long long int> enum_div(long long int n) {
  vector<long long int> ret;
  for (long long int i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i != 1 && i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  return ret;
}
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int ngcd(vector<long long int> a) {
  long long int res;
  res = a[0];
  for (long long int i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
long long int nlcm(vector<long long int> numbers) {
  long long int res;
  res = numbers[0];
  for (long long int i = 1; i < numbers.size(); i++) {
    res = lcm(res, numbers[i]);
  }
  return res;
}
long long int Pow(long long int x, long long int n) {
  long long int res = 1;
  while (n > 0) {
    if (n & 1) res = res * x;
    x = x * x;
    n >>= 1;
  }
  return res;
}
long long int mod_pow(long long int x, long long int n,
                      long long int mod = MAX) {
  long long int res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
long long int factorial(long long int n) {
  if (n > 0)
    return n * factorial(n - 1);
  else
    return 1;
}
long long int perm(long long int a, long long int b) {
  return (factorial(a) / factorial(a - b));
}
long long int comb(long long int a, long long int b) {
  return (factorial(a) / (factorial(a - b) * factorial(b)));
}
long long int sigma(long long int n, long long int m) {
  return ((n + m) * (m - n + 1) * 0.5);
}
long double hope(long double a) { return (sigma(1, a) / a); }
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;
}
class Monoid {
 public:
  long long int unit;
  Monoid() { unit = 0; }
  long long int calc(long long int a, long long int b) { return a + b; }
};
class SegmentTree {
 public:
  long long int n;
  vector<long long int> tree;
  Monoid mono;
  SegmentTree(vector<long long int> &v) {
    n = 1 << (long long int)ceil(log2(v.size()));
    tree = vector<long long int>(n << 1);
    for (long long int i = 0; i < v.size(); i++) {
      update(i, v[i]);
    }
    for (long long int i = v.size(); i < n; i++) {
      update(i, mono.unit);
    }
  }
  void update(long long int k, long long int x) {
    k += n;
    tree[k] = x;
    for (k = k >> 1; k > 0; k >>= 1) {
      tree[k] = mono.calc(tree[k << 1 | 0], tree[k << 1 | 1]);
    }
  }
  long long int query(long long int l, long long int r) {
    long long int res = mono.unit;
    l += n;
    r += n;
    while (l < r) {
      if (l & 1) {
        res = mono.calc(res, tree[l++]);
      }
      if (r & 1) {
        res = mono.calc(res, tree[--r]);
      }
      l >>= 1;
      r >>= 1;
    }
    return res;
  }
  long long int operator[](long long int k) {
    if (k - n >= 0 || k < 0) {
      return -INF;
    }
    return tree[tree.size() - n + k];
  }
  void show() {
    int ret = 2;
    for (long long int i = 1; i < 2 * n; i++) {
      cout << tree[i] << " ";
      if (i == ret - 1) {
        cout << endl;
        ret <<= 1;
      }
    }
    cout << endl;
  }
};
struct Point {
  long double x;
  long double y;
};
struct LineSegment {
  Point start;
  Point end;
};
long double calc_dist(const LineSegment &line, const Point &point) {
  long double x0 = point.x, y0 = point.y;
  long double x1 = line.start.x, y1 = line.start.y;
  long double x2 = line.end.x, y2 = line.end.y;
  long double a = x2 - x1;
  long double b = y2 - y1;
  long double a2 = a * a;
  long double b2 = b * b;
  long double r2 = a2 + b2;
  long double tt = -(a * (x1 - x0) + b * (y1 - y0));
  if (tt < 0)
    return sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
  else if (tt > r2)
    return sqrt((x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0));
  long double f1 = a * (y1 - y0) - b * (x1 - x0);
  return sqrt((f1 * f1) / r2);
}
void Main() {
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  V(a);
  long long int sum = 0;
  long long int c = nlcm(a);
  for (long long int i = 0; i < n; i++) {
    long long int z = (c - 1) % a[i];
    sum += z;
  }
  cout << (sum) << endl;
  ;
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  Main();
  return 0;
}
