#P10507. Leftward Chessmen Game

    ID: 12522 Type: Default 1000ms 256MiB

Leftward Chessmen Game

Leftward Chessmen Game

Georgia and Bob play a game using chessmen placed on a row of numbered grids. The grids are numbered from 1 onwards. Initially, there are n chessmen placed on different grids. In each turn a player picks one chessman and moves it to the left by at least one step. The chessman can be moved by any number of steps provided that it does not jump over any other chessman or cross the left border (grid 1). Also, no grid can contain more than one chessman at any time.

Georgia always starts first. Both players play optimally, meaning that if there is a winning strategy, the player will follow it. The game ends when a player is unable to make a move, and that player loses.

The problem can be analyzed as an impartial game. Suppose the chessmen are sorted according to their grid positions as \(p_1, p_2, \dots, p_n\). The number of free grids to the left of the first chessman is \(p_1 - 1\) and for each subsequent chessman the free grids available is \(p_i - p_{i-1} - 1\) for \(i \ge 2\). The winning condition is determined by the nim-sum of all these values. That is, if

[ \text{nim} = (p_1 - 1) \oplus (p_2 - p_1 - 1) \oplus \cdots \oplus (p_n - p_{n-1} - 1) \neq 0, ]

then Georgia (the first player) will win. Otherwise, Bob wins.

inputFormat

The first line contains an integer n (1 ≤ n ≤ 105), representing the number of chessmen.

The second line contains n distinct positive integers, each at most 109, representing the positions of the chessmen. The positions may not be in sorted order.

outputFormat

Output a single line containing the winner's name: either Georgia if the first player wins, or Bob otherwise.

sample

3
1 2 3
Bob

</p>