from math import gcd from itertools import combinations N, *A = map(int, open(0)) A = list(set(A)) print(sum(gcd(gcd(a, b), c) == 1 for a, b, c in combinations(A, 3)))