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