n = int(input()) A = list(map(int,input().split())) divs = set() divnum = {} for a in A: for i in range(1,int(a**0.5)+1): if a%i: continue divs.add(i) divnum[i] = divnum.get(i,0)+1 divs.add(a//i) if i != a//i: divnum[a//i] = divnum.get(a//i,0)+1 divs = sorted(divs) le = len(divs) dp = [[0]*(n+1) for i in range(le)] for i in range(le)[::-1]: d = divs[i] num = divnum[d] dp[i][num] = 1 base = 1 for j in range(num): base *= num-j base //= (j+1) dp[i][num-j-1] = base for j in range(i+1,le): if divs[j]%d: continue for k in range(num+1): dp[i][k] -= dp[j][k] print(sum(dp[0][1:]))