#include <bits/stdc++.h>
int main(void) {
  int x, i;
  scanf("%d", &x);
  int a[x];
  for (i = 0; i < x; i++) {
    scanf("%d", &a[i]);
  }
  int big = a[0];
  int n;
  for (i = 0; i < x; i++) {
    if (big < a[i]) {
      big = a[i];
      n = i;
    }
  }
  int prime;
  for (i = 1; i < big; i++) {
    if (a[n] % i != 0) {
      prime = i;
    }
  }
  prime = prime + big;
  int f;
  for (i = 0; i < x; i++) {
    f += prime % a[i];
  }
  printf("%d\n", f);
  return 0;
}
