atcoder#ARC114A. [ARC114A] Not coprime

[ARC114A] Not coprime

Score : 300300 points

Problem Statement

Given are NN integers between 22 and 5050 (inclusive): X1,X2,,XNX_1, X_2, \cdots, X_N. Find the minimum positive integer YY that satisfies the following for every i=1,2,,Ni = 1, 2, \cdots, N:

  • XiX_i and YY are not coprime.

Constraints

  • 1N491 \leq N \leq 49
  • 2Xi502 \leq X_i \leq 50
  • XiXj(ij)X_i \neq X_j (i \neq j)
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

X1X_1 X2X_2 \ldots XNX_N

Output

Print the minimum positive integer that satisfies the condition.

2
4 3
6

Being not coprime with 44 requires being even, and being not coprime with 33 requires being a multiple of 33.

1
47
47
7
3 4 6 7 8 9 10
42