def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) divisors.sort() return divisors import math n = int(input()) a = [int(i) for i in input().split()] #print(make_divisors(10)) adt = [] asrt = [] for i in range(n): #print(sorted(set(a[i]))) asrt.append(sorted(set(make_divisors(a[i])))) adt.append({ v: i for i, v in enumerate(asrt[i]) }) #adt[0][a[0]]#で座圧完了!!! dp = [[] for i in range(n)] for i in range(n): for j in range(len(asrt[i])+1): dp[i].append(0) #print(dp) #print(adt[0][a[0]]) #exit() dp[0][0] = 1 dp[0][len(asrt[0])] = 1 for i in range(1,n): for j in range(i): for k in range(len(asrt[j])+1): if k == 0: tmp = a[i] else: tmp = math.gcd(asrt[j][k-1],a[i]) #print(adt[i][tmp],tmp,dp[j][k]) dp[i][adt[i][tmp]+1] += dp[j][k] ans = 0 for i in range(n): ans += dp[i][1] print(ans)