#C721. Minimize Maximum Element

    ID: 51056 Type: Default 1000ms 256MiB

Minimize Maximum Element

Minimize Maximum Element

You are given a list of n integers. You are allowed to perform an arbitrary number of operations. In each operation, you can select any two elements a and b from the list and replace one of them with the result of the bitwise AND of a and b, i.e. \(a \& b\).

It can be observed that the bitwise AND operation never increases a number and, in fact, \(a \& b \leq \min(a,b)\). Therefore, by applying a sequence of these operations optimally, you can minimize the maximum element in the list. Your task is to determine the smallest possible value of the maximum element after performing the operations.

Hint: The answer is simply the minimum element in the initial list.

inputFormat

The input consists of two lines:

  • The first line contains an integer \(n\) representing the number of elements in the list.
  • The second line contains \(n\) space-separated integers.

outputFormat

Output a single integer, which is the minimized maximum element after performing the operations.

## sample
4
1 2 3 4
1