P26940 [AtCoder] /2 and *3
NOI
题目描述

Problem Description

Given a sequence of positive integers $A=(A_1,A_2,\dots,A_N)$ of length $ N $. You can perform the following operations any number of times (including zero) on this sequence to find the maximum achievable minimum value of the terms in the sequence.

  • First, choose one term that is an even number from the sequence and divide it by $ 2 $. Then, choose any term from the sequence and multiply it by $ 3 $.

Input Format

The input is given from the standard input in the following format:

$ N $ $ A_1 $ $ A_2 $ $\dots$ $ A_N $

Output Format

Output the answer as an integer.

Sample Input and Output

Sample Input #1

3
18 21 46

Sample Output #1

23

Sample Input #2

5
3 5 7 11 13

Sample Output #2

3

Sample Input #3

1
536870912

Sample Output #3

68630377364883

Notes/Hints

Constraints

  • All inputs are integers.
  • $1 \le N \le 10^5$
  • $1 \le A_i \le 10^9$

Sample Explanation 1

For example, you can achieve a minimum value of $ 23 $ by performing the following operations:
- Initially, $ A=(18,21,46) $.
- Divide $ A_1 $ by $ 2 $ and then multiply $ A_1 $ by $ 3 $. After this operation, the sequence becomes $ A=(27,21,46) $.
- Divide $ A_3 $ by $ 2 $ and then multiply $ A_2 $ by $ 3 $. After this operation, the sequence becomes $ A=(27,63,23) $.

Sample Explanation 2

There might be cases where no operations can be performed.

Sample Explanation 3

The answer might not fit within a 32-bit signed integer type.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 18 21 46
样例输出
23