from math import gcd n = int(input()) X = list(map(int, input().split())) st_f = [(0, 0)] st_b = [(0, 0)] r = 0 j = 0 for i in range(n): while j 1: x, y = st_f.pop() st_b.append( (x, gcd(st_b[-1][1], x)) ) st_b.pop() # print(i, j) r += n+1-j print(r)