from math import gcd;import itertools as t;n,*a=map(int,open(0)) print(sum(gcd(gcd(a,b),c)==1 for a,b,c in t.combinations(a,3)))