#T2282. Xor Pyramid Peak

Xor Pyramid Peak

链接: https://cses.fi/problemset/task/2419

板块: Bitwise Operations

时限: 1.00 s | 内存: 512 MB

题目描述

Consider a xor pyramid where each number is the xor of lower-left and lower-right numbers. The pyramid示意图见:https://cses.fi/file/382652cc16953396bbaeeabf0e98daec74a4bda09afb8db8da0e67870205fc76

Given the bottom row of the pyramid, your task is to find the topmost number.

输入

The first line has an integer nn: the size of the pyramid.

The next line has nn integers a1,a2,,ana_1,a_2,\dots,a_n: the bottom row of the pyramid.

输出

Print one integer: the topmost number.

数据范围

1n21051 \le n \le 2 \cdot 10^5 1ai1091 \le a_i \le 10^9

样例输入

8
2 10 5 12 9 5 1 5

样例输出

9