Winter Capital of Programmers
Kharkiv is the heart of the historical-geographical region in Ukraine known as "Slobozhanshchyna". The city is situated at the intersection of the forest-steppe and steppe natural-geographical zones. Currently, Kharkiv spans over 300 square kilometers and has a population of 1,461,000 people.
The area that is now modern Kharkiv has been inhabited since ancient times. The Slavs established a settlement on the future site of Kharkiv as early as the 8th century, which evolved into the city of Donets by the 10th century. Archaeological findings reveal that Donets was not only a fortress but also a hub for crafts and a significant point for transit trade. The first recorded mention of Donets in chronicles dates back to 1185. This city is also referenced in "The Tale of Igor's Campaign" — a notable work from the Kievan Rus' era. Donets was destroyed by Batu's hordes in the mid-13th century.
To learn more about the city's history, visit the page history of the city of Kharkiv...
Recently, Kharkiv has also earned the title of the winter capital of programmers in Ukraine. Each year, hundreds of top young programmers from Ukraine and other countries gather here for nearly two weeks to teach each other how to tackle various complex modern programming challenges.
Naturally, they sometimes present easier problems—everyone should be able to solve at least something... :) We present you with one such problem to solve.
During the Winter Schools in Kharkiv, a daily newspaper is published, with issues numbered in the binary number system. Over the years, many such newspapers and other materials have accumulated, numbered in a single register, but in the decimal number system. A programmer (a first-year student) organizing the university's paper records was curious about the following question: "Here in front of me is a pile of N documents, newspapers, and other materials, each with its own number (some numbers, like identical newspaper numbers, may repeat). Which number among these N numbers has the most binary one bits?"
Help the student find the answer to this intriguing question, as he is not yet able to solve it himself.
Input
The first line contains the number of documents N (1 ≤ N ≤ 10^5), and the second line contains the document numbers a_i, each not exceeding 2^31-1.
Output
Output a single number—the number of the document with the most binary one bits. If there are multiple such documents, output the one with the smallest number.