Time limit: 1s
Memory limit: 128MB
Input:
Output:
Task
A sequence with elements is homogeneous if, for any two chosen positions and with , the elements and are coprime.
You are given a sequence of length with nonzero positive integers. Determine the number of its homogeneous subsequences.
Input data
The first line will contain the number , representing the length of the sequence.
The second line will contain the values of the sequence , separated by spaces.
Output data
The first line of the output file will contain the number of homogeneous subsequences of the sequence.
Constraints and clarifications
- .
- , for .
# | Points | Restrictions |
---|---|---|
1 | 18 | |
2 | 43 | , |
3 | 39 | No additional restrictions. |
Example
stdin
8
7 2 4 2 1 5 1 1
stdout
19
Explanation
For example, one of the homogeneous sequences is because , , and .
On the other hand, the sequence is not homogeneous because .