Under construction

Still being built. Things may change

Drop the Bit

Interview

Time limit1sMemory limit1024 MB

Summary
Given N and the counts of 1 bits in two N-bit binary numbers x and y, find the maximum possible value of x XOR y.
Level

Easy3 of 10

Topics
Math, Greedy
Solved
No attempts yet

Problem

Wrapper H.Arc, who plays with bits, came up with two NN-digit binary numbers xx and yy one day when composing was not going well. He then left a note:

In xx, aa digits are 11, and in yy, bb digits are 11. Both numbers may start with 00.

You found this note and wondered about the maximum value of x⊕yx \oplus y over all pairs xx, yy that H.Arc could have come up with. Find this value.

Input

The first line contains NN. (1≤N≤10)(1 \le N \le 10)

The second line contains aa and bb, separated by a space. (0≤a,b≤N)(0 \le a, b \le N)

Output

Print the maximum value of x⊕yx \oplus y.

Hint

⊕\oplus is the bitwise XOR operation. For two binary numbers a,ba, b, the ii-th digit of a⊕ba \oplus b is 00 if the ii-th digits of aa and bb are equal, and 11 otherwise.

Examples2

  1. Example 1

    Input
    2
    1 1
    
    Expected output
    3
    
  2. Example 2

    Input
    3
    2 2
    
    Expected output
    6