#C8066. Magical Fruits

    ID: 52007 Type: Default 1000ms 256MiB

Magical Fruits

Magical Fruits

In this problem, you are given n types of magical fruits, where each fruit type has an associated magical property represented by an integer. The task is to determine the maximum possible magical property that can be achieved by combining these fruits. The magical property when combining fruits is calculated using the bitwise OR operation.

Formally, if the magical properties are given as \(A_1, A_2, \dots, A_n\), then the maximum magical property value is computed as:

\(A_1 \lor A_2 \lor \dots \lor A_n\)

This is because the bitwise OR operation includes all the bits that are present in any of the numbers. Your goal is to compute this value efficiently.

inputFormat

The input consists of two lines:

  • The first line contains an integer n \((1 \leq n \leq 10^5)\), the number of fruit types.
  • The second line contains n space-separated integers \(A_1, A_2, \dots, A_n\) \((0 \leq A_i \leq 10^9)\) representing the magical property values of the fruits.

outputFormat

Output a single integer, which is the maximum magical property value obtainable by combining the fruits using the bitwise OR operation.

## sample
3
1 2 4
7