use std::cmp::max; fn dfs(current: &mut Vec, used: &mut Vec, values: &Vec, n: usize) -> usize { let mut result: usize = 0; if current.len() == n / 2 { return current.iter().fold(0usize, |acc, &x| acc ^ x); } for i in 0..n { if used[i] { continue; } for j in i+1..n { if used[j] { continue; } used[i] = true; used[j] = true; current.push(values[i] + values[j]); result = max(result, dfs(current, used, values, n)); current.pop(); used[i] = false; used[j] = false; } } result } fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); let mut a = String::new(); std::io::stdin().read_line(&mut a).ok(); let a: Vec = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let mut current: Vec = vec![]; let mut used: Vec = vec![false; n]; println!("{}", dfs(&mut current, &mut used, &a, n)); }