#include <bits/stdc++.h>
int main(void) {
  int N;
  scanf("%d", &N);
  int numbers[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &numbers[i]);
  }
  int count = 1;
  int amari[N];
  int sum_amari;
  int saisyou_koubaisuu;
  while (1) {
    sum_amari = 0;
    for (int i = 0; i < N; i++) {
      sum_amari += count % numbers[i];
    }
    if (sum_amari == 0) {
      saisyou_koubaisuu = count;
      break;
    }
    count++;
  }
  int f;
  int ans = -1;
  for (int i = 0; i < saisyou_koubaisuu; i++) {
    f = 0;
    for (int j = 0; j < N; j++) {
      f += i % numbers[j];
    }
    if (ans < f) {
      ans = f;
    }
  }
  printf("%d\n", ans);
  return 0;
}
