import sys;input=sys.stdin.readline def gcd(a, b): if a < b: a, b = b, a if b == 0: return a while a % b: a, b = b, a%b return b n = int(input()) X = list(map(int, input().split())) st_f = [(0, 0), (X[0], X[0])] st_b = [(0, 0)] r = 0 j = 1 for i in range(n): while j<=n: if gcd(st_f[-1][1], st_b[-1][1]) == 1: break if j == n: j += 1 break # print(j) st_f.append( (X[j], gcd(st_f[-1][1], X[j])) ) j += 1 if len(st_b) == 1: while len(st_f) > 1: x, y = st_f.pop() st_b.append( (x, gcd(st_b[-1][1], x)) ) st_b.pop() r += n-j+1 print(r)