eolymp
Competitions

2021-2022 ICPC, SEERC, 1/8 Final

Integer division by 5

There are $n$ stones on the table. For $1$ coin, you can do one of the following operations: \begin{itemize} \item Pick up one stone from the table. \ textbf {You cannot perform this operation if there are no stones on the table}. \item Place another stone on the table. \end{itemize} What is the smallest number of coins you need to spend so that the number of stones on the table is divisible by $5$? Please note that $0$ is divisible by any number, which means that if there are $0$ stones left on the table, then the condition of the problem is satified. \InputFile One integer $n$ ($0 \le n \le 10^9$) --- initial number of stones on the table. \OutputFile Print a single integer - the minimum number of coins that you need to spend so that the number of stones on the table is divisible by $5$. \Note In the first example, initially there are $0$ stones on the table. $0$ is divisible by $5$, so no coins need to be spent. In the second example, you can pay one coin and take one stone from the table. Then there will be $0$ stones on the table, and $0$ is divided by $5$. In the third example, you can pay one coin and put another stone on the table (thus, there will be $4$ stones on the table), and then pay another coin and put another stone on the table, thus getting $5$ stones, which is divided by $5$.
Time limit 1 second
Memory limit 128 MiB
Input example #1
0
Output example #1
0
Input example #2
1
Output example #2
1
Input example #3
3
Output example #3
2