QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 64 MB 満点: 10

#6014. Piggy bank [B]

統計

In Byteotia, as befits a computerized state, only coins with denominations that are powers of two bytecoins are in circulation. Thus, for example, there are coins with denominations of 1, 16, or 128 bytecoins; however, coins with denominations such as 3 or 12 bytecoins are not produced.

Bytek, a young resident of Byteotia, has a large piggy bank at home. Every day, as soon as he returns home from school, he receives pocket money in the form of a single Byteotian coin, which he immediately drops into the piggy bank.

Many days have passed since Bytek started collecting coins, and the piggy bank is now filled to the brim. Bytek has therefore decided to break it and take out all the coins. He will now go to the bank to exchange some of them for other coins. He would like to do this in such a way that the most valuable of the coins he obtains has the largest possible denomination. What will this denomination be?

Input

The first line of input contains a single integer $n$ ($1 \le n \le 1\,000\,000$) representing the number of coins put by Bytek into the piggy bank. The next line contains a description of all these coins. It contains a sequence of $n$ natural numbers $a_1, a_2, \dots, a_n$ ($0 \le a_i \le 201\,718$), which means that the values of the coins in the piggy bank are equal to $2^{a_1}, 2^{a_2}, \dots, 2^{a_n}$ bytecoins, respectively.

Output

The first and only line of output should contain a single natural number $b$ meaning that the most valuable coin Bytek is able to obtain has a denomination of $2^b$ bytecoins.

Examples

Input 1

5
3 4 1 3 3

Output 1

5

Note 1

The coins in the piggy bank have denominations of 8, 16, 2, 8, and 8 bytecoins. In total, they are worth 42 bytecoins. To obtain a larger denomination, Bytek can exchange coins with denominations of 8, 16, 8, and 8 (worth 40 bytecoins in total) at the bank for coins with denominations of 32, 4, and 4 (also worth 40 bytecoins in total). The most valuable coin he will obtain will have a denomination of $2^5$ bytecoins.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.