#include <bits/stdc++.h>
int main() {
  int N = 0;
  int j = 1;
  int ja = 0;
  int md = 0;
  int summd = 0;
  int f = 0;
  if (scanf("%d", &N) < 1) {
    exit(1);
  }
  int a[N];
  for (int i = 0; i < N; i++) {
    if (scanf("%d", &a[i]) < 1) {
      exit(1);
    }
  }
  while (j != 0) {
    summd = 0;
    ja = j * a[0];
    for (int i = 1; i < N; i++) {
      md = ja % a[i];
      summd += md;
      if (md != 0) {
        break;
      }
    }
    if (summd != 0) {
      j++;
    } else {
      j = 0;
    }
  }
  ja -= 1;
  for (int i = 0; i < N; i++) {
    f += ja % a[i];
  }
  printf("%d\n", f);
}
