We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. Practice
  2. Algorithms
  3. Bit Manipulation
  4. Yet Another Minimax Problem

Yet Another Minimax Problem

Problem
Submissions
Leaderboard
Discussions
Editorial

You are given non-negative integers, . We define the score for some permutation () of length to be the maximum of for .

Find the permutation with the minimum possible score and print its score.

Note: is the exclusive-OR (XOR) operator.

Input Format

The first line contains single integer, , denoting the number of integers.
The second line contains space-separated integers, , describing the respective integers.

Constraints

Output Format

Print a single integer denoting the minimum possible score.

Sample Input 0

4
1 2 3 4

Sample Output 0

5

Sample Input 1

3
1 2 3

Sample Output 1

2

Explanation

Sample Case 0:
The permutation with the minimum score is :


Because the permutation's score is the maximum of these values, we print on a new line.

Sample Case 1:
The permutation with the minimum score is :

Because the permutation's score is the maximum of these values, we print on a new line.

Author

zemen

Difficulty

Medium

Max Score

30

Submitted By

3802

Need Help?


View discussions
View editorial
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature