fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let mut f: Vec = s.split_whitespace().flat_map(str::parse).collect(); let n = f.pop().unwrap() as usize; (2..=n).for_each(|i| f.push(f[i - 1] ^ f[i - 2])); println!("{}", f[n]) }