#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
  if ((x == 0) || (y == 0)) return 0;
  while (x != y) {
    if (x > y)
      x = x - y;
    else
      y = y - x;
  }
  return x;
}
int lcm(int x, int y) {
  if ((x == 0) || (y == 0)) return 0;
  return x * y / gcd(x, y);
}
int main(void) {
  int n;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int tmp = a[0];
  for (int i = 1; i < n; i++) {
    tmp = lcm(tmp, a[i]);
  }
  tmp--;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += tmp % a[i];
  }
  printf("%d\n", sum);
  return 0;
}
