#P4296. Password Decryption

    ID: 17542 Type: Default 1000ms 256MiB

Password Decryption

Password Decryption

In a fortunate twist of fate, Coco has discovered a mysterious safe rumored to contain an ancient treasure map. However, to open the safe, Coco must first decipher the password. On the back of the safe, there is an ancient symbol that gives a hint: let \( n \) be a given number and \( x \) be the password. The conditions are as follows:

\( 0 \le x < n \) and \( x^2 \equiv 1 \pmod{n} \).

Since there might be more than one valid password, your task is to help Coco by computing all values of \( x \) that satisfy the above conditions.

inputFormat

The input consists of a single integer \( n \) representing the number considered. \( n \) is provided on the first line of input.

outputFormat

Output all integers \( x \) (in ascending order) that satisfy \( 0 \le x < n \) and \( x^2 \equiv 1 \pmod{n} \). The numbers should be separated by a single space.

sample

2
1