#arc125b. [arc125_b]Squares
[arc125_b]Squares
Problem Statement
You are given an integer . Find the number of pairs of integers that satisfy the following conditions, modulo .
-
.
-
is a square number. (Assume is also a square number.)
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3
Sample Output 1
2
We have the following two pairs.
Sample Input 2
10
Sample Output 2
8
Sample Input 3
10000000000
Sample Output 3
52583544