eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Red John Game

Red John Game

Ліміт часу 0.5 секунд
Ліміт використання пам'яті 256 MiB

Red John has a chess table of infinite dimensions, and n×n pawns, arranged in an n×n square. The pawns can be moved horizontally or vertically, buy jumping over an (horizontally or vertically) adjacent pawn, and onto the next position, only if this position is unoccupied by another pawn. Also, when a valid move occurs, the jumped pawn is removed. Can you help Red John figure out if there is a sequence of moves which leaves only one pawn on the table ?

Below, such a sequence of moves is illustrated, for n = 2. Pawns are depicted by the letter P.

Вхідні дані

The program input is from a text file. Each file contains a value for n, with 0 < n < 10^9.

Вихідні дані

The output consists of 1 if there is a sequence of moves leaving only one pawn on the table, and 0 otherwise. There cannot be any whitespace and newline characters in the output. Two examples of input/output pairs are shown below.

Приклад

Вхідні дані #1
3
Вихідні дані #1
0
Джерело ACM SEERC 2013, SouthEastern European Region, October, 12/10/2013, Vinnica & Bucharest