from math import gcd n = int(input()) ans = 0 alst = [int(input()) for _ in range(n)] for i in range(n): for j in range(i + 1, n): ij = gcd(alst[i], alst[j]) if ij == 1: ans += n - j - 1 continue for k in range(j + 1, n): if gcd(alst[k], ij) == 1: ans += 1 print(ans)