Nim Game Without Repeats

Time limit2sMemory limit512 MB

Summary
Nim with piles of size up to 60, but each specific removal size can be used at most once per pile; decide the winner under optimal play.
Level

Hard9 of 10

Topics
Game theory, Dynamic programming, Bit manipulation, Combinatorics
Solved
No attempts yet

Statement

Koosaga and Cubelover are about to play a Nim game. The game uses NN piles of stones, and the ii-th pile contains AiA_i stones. The two players take turns. Each turn consists of choosing one pile and removing one or more stones from that pile.

Koosaga moves first, and the player who cannot remove any stone on their turn loses.

They have played this game so many times that today they are adding one new rule.

The new rule is that the same number of stones cannot be removed from a pile twice. For example, if a player has taken 4 stones from a pile, then no one may take 4 stones from that pile again. This rule applies to both players and applies to each pile independently.

Write a program that determines who wins when both players play optimally.

Input

The first line gives the number of piles N(1≤N≤106)N(1 \le N \le 10^6). The second line gives the numbers of stones in the piles A1,A2,…,AN(1≤Ai≤60)A_1, A_2, \dots, A_N(1 \le A_i \le 60).

Output

Print "koosaga" if Koosaga wins the game, and "cubelover" if Cubelover wins.

Examples2

  1. Example 1

    Input
    1
    5
    
    Expected output
    koosaga
    
  2. Example 2

    Input
    2
    1 2
    
    Expected output
    cubelover