#include <bits/stdc++.h>
int main(void) {
  int a, c;
  int i = 0;
  int j = 2;
  int k = 1;
  int mod = 1;
  int sum = 0;
  scanf("%d", &a);
  int b[a];
  for (int i = 0; i < a; i++) {
    scanf("%d", &b[i]);
  }
  int f[100000] = {};
  for (int i = 0; i < a; i++) {
    c = b[i];
    while (c >= j) {
      if (c % j == 0) {
        k = k * j;
        if (f[j] < k) f[j] = k;
        c = c / j;
      } else {
        j++;
        k = 1;
      }
    }
    k = 1;
    j = 2;
  }
  for (int i = 0; i < 100000; i++) {
    if (f[i] != 0) mod = mod * f[i];
  }
  for (int i = 0; i < a; i++) {
    sum = sum + ((mod - 1) % b[i]);
  }
  printf("%d\n", sum);
  return 0;
}
