Coprime Pairs
Count the index pairs i < j with gcd(ai, aj) = 1.
Input: the first line has N; the second line has N positive integers.
Output: the number of coprime pairs.
Constraints:
- 2 ≤ N ≤ 105
- 1 ≤ ai ≤ 105
Sample Tests
Input 1
3 2 3 4
Output 1
2
Input 2
2 6 6
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.