#include <bits/stdc++.h>
int n, arr[3005];
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int f(long long x) {
  int res = 0;
  for (int i = 0; i < n; ++i) {
    res += (x % arr[i]);
  }
  return res;
}
long long findlcm(int arr[], int n) {
  long long ans = arr[0];
  for (int i = 1; i < n; i++) ans = (((arr[i] * ans)) / (gcd(arr[i], ans)));
  return ans;
}
void task() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &arr[i]);
  }
  long long xx = findlcm(arr, n);
  printf("%d\n", f(xx - 1));
}
int main() {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
  task();
}
