import sys from itertools import combinations as combi from math import gcd input = sys.stdin.readline N = int(input()) a = [int(input()) for _ in range(N)] res = 0 for c in combi(a, 3): res += gcd(gcd(c[0], c[1]), c[2]) == 1 print(res)