#include <bits/stdc++.h>
using namespace std;
int arr[5001];
int a[5001];
int n;
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int getGcd(int a, int b) {
  int c;
  while (b) {
    c = a;
    a = b;
    b = c % b;
  }
  return a;
}
int f(int m) {
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += m % a[i];
  }
  return ans;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    a[i] = arr[i];
    if (i != 1) {
      arr[i] = arr[i - 1] / getGcd(arr[i - 1], arr[i]) * arr[i];
    }
  }
  cout << f(arr[n] - 1) << endl;
}
