beecrowd | 2667

Mouth Game

By Maratona de Programção da SBC, ACM ICPC 2017 BR Brazil

Timelimit: 1

A popular children's game is 21 of Mouth . The game is played as follows: the first player says a number, n0, which can be either 1 or 2. The second player can then say a number n1 such that n1 ∈{ n0 + 1 , n0 + 2 }. And so on, the players alternate, always saying a number that is one or two greater than the previous one. The player who says 21 wins the game. For example, the sequence of numbers could be: 1, 3, 5, 6, 6, 7, 9, 11, 12, 14, 15, 16, 18, 19, 21. In this game, the first player always loses, if the second player knows how to play well.

With each new generation, children get smarter. Nowadays, although they find 21 of Mouth an interesting game, many kids don't feel challenged enough and so they decided to generalize the game, creating N of Mouth. Given an integer N, instead of 21, the first player can choose 1 or 2. From then on the players alternate, adding 1 or 2 to the previous number, until one of them says the number N and wins the game. Knowing that both players are excellent and can play very well, your problem is to determine which starting integer the first player must choose to win the game.

Input

The input consists of a single line containing the integer N (3 ≤ N ≤ 10100) chosen for the current mouth N match.

Output

Your program is required to produce a single line with an integer representing the number, in {1,2}, which the first player must choose, to win the game. If this is not possible, then the integer must be zero.

Input Samples Output Samples

7

1

9

0

12341234123412341234123412341234

2