Jogo de Boca

Given the target N, decide whether the first player can win the 1-2 counting game and which opening move (1 or 2) wins.

Medium4Game theoryMathNo attempts yetTime limit1sMemory limit1024 MB

Problem

A popular children's game is the 21 game. It goes like this. The first player says a number n0n_0 that is either 1 or 2. The second player then says a number n1n_1 with n1{n0+1, n0+2}n_1 \in \{n_0 + 1,\ n_0 + 2\}. The players keep taking turns, each one saying a number that is one or two larger than the previous one, and whoever says 21 wins. One possible run is 1, 3, 5, 6, 7, 9, 11, 12, 14, 15, 16, 18, 19, 21. In this game the first player always loses if the second player plays well.

Children find the 21 game too easy these days, so they generalized it into the N game. Given an integer NN in place of 21, the first player picks 1 or 2. After that the players alternate, adding 1 or 2 to the previous number, until one of them says NN and wins. Both players play perfectly. Determine which number the first player should say at the start in order to win.

Input

The first line contains the target number NN of the current game. (3N101003 \le N \le 10^{100})

Output

Print on one line the number in {1,2}\{1, 2\} that the first player should say at the start in order to win. If the first player cannot win, print 0.