Coprime Numbers

No attempts yetTime limit5sMemory limit128 MB

Problem

Two positive integers are called coprime if their only common divisor is 11. Given a sequence of positive integers a1,a2,,ana_1, a_2, \dots, a_n, count how many pairs of its terms are coprime.

Input

The first line contains one integer nn (1n1061 \le n \le 10^6), the length of the sequence. The second line contains nn integers aia_i (1ai3×1061 \le a_i \le 3 \times 10^6), separated by spaces.

Output

Print a single integer: the number of pairs (i,j)(i, j) with 1i<jn1 \le i < j \le n such that aia_i and aja_j are coprime.