#P10696. Maximum Bitwise AND Score
Maximum Bitwise AND Score
Maximum Bitwise AND Score
MCPlayer542 is facing a challenging problem. He has written n different codes, where the i-th code earns a score of gi. Due to special contest rules, he must make two submissions, and his final score will be the bitwise AND of the scores from the two submissions. Formally, if he submits the i-th and j-th codes, his score will be given by
$$g_i \& g_j$$
Since he is allowed to submit the same code twice, the maximum achievable score is simply
$$\max_{1\le i,j\le n}(g_i \& g_j)=\max_{1\le i\le n}g_i.$$
Your task is to determine the highest score he can achieve given the scores of his submissions.
inputFormat
The input consists of two lines:
- The first line contains an integer n, the number of codes.
- The second line contains n integers, where the i-th integer represents gi.
outputFormat
Output a single integer representing the maximum possible score that MCPlayer542 can achieve.
sample
1
42
42