P29430 [洛谷] [COCI2013-2014#1] ORGANIZATOR
普及+
题目描述

Problem Description

In a competition, you are required to calculate the number of participants in the final round.

Given $n$ integers, $A_1, A_2, \cdots, A_n$, you need to find a positive integer $x$ such that there are $m$ (where $m \geq 2$) integers in $A$ that are multiples of $x$. The number of participants in the final round, denoted as $s$, is calculated as $m \cdot x$.

Note that for a positive integer $x$, if the corresponding $m$ value is $1$, this scheme is invalid.

Find the $x$ that maximizes $s$ and output $s$.

Input Format

The first line of input contains a positive integer $n$.

The second line contains $n$ integers separated by spaces, $A_i$.

Output Format

Output a single integer $s$.

Sample Input and Output

Sample Input #1

3
1 2 4

Sample Output #1

4

Sample Input #2

2
1 5

Sample Output #2

2

Sample Input #3

5
4 6 3 8 9

Sample Output #3

9

Notes

Sample 1 Explanation

For $x = 2$, $A_2$ and $A_3$ meet the condition, and the answer is $2 \times 2 = 4$.

Data Constraints

  • For $30\%$ of the data, $n < 1000$.
  • For $100\%$ of the data, $2 \leq n \leq 2 \times 10^5$, $1 \leq A_i \leq 2 \times 10^6$.

Notes

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

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 1 2 4
样例输出
4