// ---------- begin next_permutation ---------- fn next_permutation(a: &mut [T]) -> bool { a.windows(2).rposition(|a| a[0] < a[1]).map_or(false, |x| { let y = a.iter().rposition(|b| a[x] < *b).unwrap(); a.swap(x, y); a[(x + 1)..].reverse(); true }) } // ---------- end next_permutation ---------- fn read() -> Vec { let mut s = String::new(); use std::io::Read; std::io::stdin().read_to_string(&mut s).unwrap(); let mut it = s.trim().split_whitespace(); let mut next = || it.next().unwrap().parse::().unwrap(); let n = next(); (0..n).map(|_| next()).collect() } fn main() { let mut a = read(); a.sort(); let mut ans = 0; while { let mut xor = 0; for a in a.chunks_exact_mut(2) { xor ^= a[0] + a[1]; a.sort_by_key(|a| !*a); } ans = ans.max(xor); next_permutation(&mut a) } {} println!("{}", ans); }