from math import gcd n = int(input()) X = list(map(int, input().split())) st_f = [(0, 0), (X[0], X[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-j print(r)