Irreducible Fractions
시간 제한3초메모리 제한2048 MB
서로 다른 네 인덱스를 골라 두 값의 곱을 나머지 두 값의 곱으로 나눈 분수가 기약분수가 되는 경우의 수를 센다.
문제
Given an array consisting of positive integers, find the number of quadruples of distinct indices such that the following fraction is irreducible:
입력
The first line contains an integer () denoting the length of the array. The second line contains integers (), the elements of the array.
출력
Output a single integer: the number of quadruples satisfying the given condition.