#P6539. [COCI 2013/2014 #1] ORGANIZATOR

[COCI 2013/2014 #1] ORGANIZATOR

Background

There is a competition, and you are asked to compute the number of people who advance to the final.

Problem Description

The number of people who advance to the final satisfies the following rules:

You are given nn integers A1,A2,,AnA_1, A_2, \cdots, A_n.

You need to find a positive integer xx. Suppose there are mm (m2m \geq 2) values among AiA_i that are multiples of xx, then the number of finalists is ss, whose value is mxm \cdot x.

Note that for a positive integer xx, if the corresponding value of mm is 11, then this choice is invalid.

Please find an xx that makes ss as large as possible, and output ss.

Input Format

The first line contains a positive integer nn.

The second line contains nn integers AiA_i separated by spaces.

Output Format

Output an integer ss.

3
1 2 4
4
2
1 5
2
5
4 6 3 8 9
9

Hint

Explanation for Sample 1

Let x=2x = 2. Then A2,3A_{2,3} satisfy the condition, and the answer is 2×2=42 \times 2 = 4.

Constraints

  • For 30%30\% of the testdata, n<1000n < 1000.
  • For 100%100\% of the testdata, 2n2×1052 \le n \le 2 \times 10^5, 1Ai2×1061 \le A_i \le 2 \times 10^6.

Notes

This problem is translated from COCI2013-2014 CONTEST #1 T5 ORGANIZATOR.

Translated by ChatGPT 5