#include <bits/stdc++.h>
using namespace std;
int n;
int an[100010];
int f(int m) {
  int res = 0;
  for (int i = 0; i < n; i++) {
    res += (m % an[i]);
  }
  return res;
}
int gcd(int a, int b) {
  if (a < b) {
    int tmp = b;
    b = a;
    a = tmp;
  }
  if (b == 0)
    return a;
  else
    gcd(b, a % b);
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
  cin >> n;
  int tmp[n];
  for (int i = 0; i < n; i++) {
    cin >> an[i];
    tmp[i] = an[i];
  }
  sort(an, an + n);
  int res = 0;
  for (int i = 0; i < n - 1; i++) {
    res = (lcm(tmp[i], tmp[i + 1]));
    tmp[i + 1] = res;
  }
  res = (tmp[n - 1] - 1);
  cout << f(res) << endl;
}
