#K52447. Split Deck of Cards

    ID: 29311 Type: Default 1000ms 256MiB

Split Deck of Cards

Split Deck of Cards

You are given a deck of (N) cards numbered from 1 to (N). Your task is to split the deck into two subsets such that:

  1. The difference between the maximum cards in the two subsets, ( |\max(A) - \max(B)| ), is minimized.
  2. The absolute difference between the sums of the cards in the two subsets, ( |\sum A - \sum B| ), is minimized.

Output the two minimized differences separated by a space.

Note: If (N) is even, the answer will be 0 0; if (N) is odd, the answer will be 0 1.

Constraints: (2 \leq N \leq 10^6).

inputFormat

The input consists of a single integer (N) provided via standard input.

outputFormat

Output two space-separated integers: the minimized difference of the maximum cards and the minimized absolute difference of the sums, printed to standard output.## sample

2
0 0