oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

towering Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

towering.html

Problem Description

Gug is bored, so he took out a bunch of his childhood toys and started building a tower. The tower has comprises of N blocks at its base, N - 1 block on the next level, and so on, until one final block at the top of the tower. Here is an illustration of the tower:

Gug, being Gug, writes a number onto each of the blocks on the tower's base. Let the ith number from the left be Ai. He then goes up the tower, layer by layer, and labels each block with the XOR of the two numbers below it.

Gug wants to know what the top number will be.

Limits

Subtask 1 (24%): 1 ≤ N ≤ 2000, 0 ≤ Ai ≤ 109.

Subtask 2 (27%): 1 ≤ N ≤ 500000, 0 ≤ Ai ≤ 1.

Subtask 3 (49%): 1 ≤ N ≤ 500000, 0 ≤ Ai ≤ 109.

Subtask 4 (0%): Sample Testcases.

Input

The first line of input will contain one integer, N.

The second line of input will contain N integers, representing the array A.

Output

The output should contain one integer, the number at the top of Gug's tower.

Sample Testcase 1

Input

3
5 2 3

Output

6

Sample Testcase 2

Input

6
7 2 6 11 3 0

Output

6

Tags

Math

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
124221s256MBMinimum
227201s256MBMinimum
349621s256MBMinimum
4021s256MBMinimum

Judge Compile Command

g++-8 ans.cpp -o towering -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.