405082: GYM101778 C Professor Agasa Lab
Description
Professor Agasa always tries to help Conan solve the crimes and he has invented all Conan's special gadgets.
Currently, Professor Agasa is solving a complex murder case, so he is performing a series of tests in his laboratory. After two months of searching, Professor Agasa figured that all the evidence he needs to solve the case can be found in a safe inside one of the suspect's house. Professor Agasa is so close to open the safe, he only needs to solve one more puzzle and all the secrets inside the safe will be for him. The final puzzle is as follows:
If you have the following equation
You are given m, count how many different pairs (a, b) (1 ≤ a, b < m) exist, such that you can use them to calculate y and x under the given modules m.
Professor Agasa is so tired of solving puzzles all the day in order to open the safe. Can you help him by solving the last puzzle?
InputThe first line of the input contains an integer T (1 ≤ T ≤ 105), in which T is the number of test cases.
Then T lines follow, each line contains an integer m (1 ≤ m ≤ 106), in which m is the described modulus in the problem statement.
OutputFor each test case, print a single line containing how many different pairs (a, b) (1 ≤ a, b < m) exist, such that Professor Agasa can use them to calculate y and x under the given modules m.
ExampleInput2Output
6
10
10Note
36
In the first test case, there are 10 different pairs that satisfy the problem conditions, which are: (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (5, 1), (5, 2), (5, 3), (5, 4), and (5, 5)