PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000233. Số nhỏ nhất không nguyên tố cùng nhau (Not coprime)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Số nhỏ nhất không nguyên tố cùng nhau (Not coprime)

Số nhỏ nhất không nguyên tố cùng nhau (Not coprime)

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Given pairwise distinct integers XiX_i between 2 and 50, find the smallest positive integer YY such that gcd⁡(Xi,Y)>1\gcd(X_i,Y)>1 for every ii.

Input

  • First line: integer nn.
  • Second line: nn array elements. All elements must be distinct.

Output

Print the smallest positive integer YY.

Subtasks

  • Subtask 1 (20 points): 1≤n≤10, 2≤Xi≤201\le n\le10,\ 2\le X_i\le20.
  • Subtask 2 (30 points): 1≤n≤30, 2≤Xi≤351\le n\le30,\ 2\le X_i\le35.
  • Subtask 3 (50 points): 1≤n≤49, 2≤Xi≤501\le n\le49,\ 2\le X_i\le50.

Examples

Example 1

Input

2
4 3

Output

6

Explanation

The result must have a factor of 2 and a factor of 3, giving 6.

Example 2

Input

1
47

Output

47

Explanation

To share a nontrivial divisor with 47, the smallest possible value is 47.