import sys;input=sys.stdin.readline def gcd(a,b): if b == 0: return a return gcd(b,a%b) class SegTree: def __init__(self, init_val, n, ide_ele, seg_func): self.segfunc = seg_func self.num = 2**(n-1).bit_length() self.ide_ele = ide_ele self.seg=[self.ide_ele]*2*self.num for i in range(n): self.seg[i+self.num-1]=init_val[i] for i in range(self.num-2,-1,-1) : self.seg[i]=self.segfunc(self.seg[2*i+1],self.seg[2*i+2]) def update(self, k, x): k += self.num-1 self.seg[k] = x # k+1ではなくkでは? while k+1: k = (k-1)//2 self.seg[k] = self.segfunc(self.seg[k*2+1],self.seg[k*2+2]) def query(self, p, q): if q<=p: return self.ide_ele p += self.num-1 q += self.num-2 res=self.ide_ele while q-p>1: if p&1 == 0: res = self.segfunc(res,self.seg[p]) if q&1 == 1: res = self.segfunc(res,self.seg[q]) q -= 1 p = p//2 q = (q-1)//2 if p == q: res = self.segfunc(res,self.seg[p]) else: res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q]) return res n = int(input()) X = list(map(int, input().split())) st = SegTree(X, n, 0, gcd) j = 1 r = 0 for i in range(n): while j <= n: if st.query(i, j) == 1: break j += 1 r += n+1-j # print(i, j) print(r)