#P3812. 【模板】线性基

【模板】线性基

Description

Given nn integers (numbers may repeat), choose any subset of them so that their XOR sum is maximized.

Input Format

The first line contains an integer nn, the number of elements. The next line contains nn integers.

Output Format

Output a single integer on one line, the answer.

2
1 1
1
4
1 5 9 4

13

Hint

Constraints: 1n501 \leq n \leq 50, 0Si<2500 \leq S_i < 2^{50}.

Translated by ChatGPT 5