#K57462. Minimum Balance of a Binary String

    ID: 30426 Type: Default 1000ms 256MiB

Minimum Balance of a Binary String

Minimum Balance of a Binary String

You are given an integer n which represents the length of a binary string. A binary string consists only of the characters '0' and '1'. The balance of a binary string is defined as the absolute difference between the number of 0's and 1's, i.e. \( |\#0 - \#1| \).

Your task is to determine the minimum possible balance that can be achieved for any binary string of length n. Note that:

  • If n is even, it is possible to have an equal number of 0's and 1's, so the minimum balance is \(0\).
  • If n is odd, one of the characters will be one more than the other; hence, the minimum balance is \(1\).

Formally, the answer is given by:

[ \text{answer}(n) = \begin{cases} 0, & \text{if } n \text{ is even} \ 1, & \text{if } n \text{ is odd} \end{cases} ]

</p>

inputFormat

The input consists of a single integer n on a single line, representing the length of the binary string.

Constraints: \(1 \leq n \leq 10^9\).

outputFormat

Output the minimum possible balance of any binary string of length n, where the balance is defined as \( |\#0 - \#1| \).

## sample
4
0