n = gets.to_i a = gets.split.map(&:to_i) stack = [[[], 0]] ans = 0 until stack.empty? e, bit = stack.pop if e.size == n / 2 ans = [ans, e.reduce{|x, y| x ^ y}].max else (0...n).each do |x| ((x + 1)...n).each do |y| stack << [[*e, a[x] + a[y]], (bit | (1 << x) | (1 << y))] if (bit & (1 << x)) == 0 && (bit & (1 << y)) == 0 end end end end puts ans