from math import gcd import sys input=sys.stdin.buffer.readline N=int(input()) A=list(map(int,input().split())) n=N.bit_length() _GCD=[[0 for i in range(n)] for i in range(N)] for i in range(N): _GCD[i][0]=A[i] for j in range(1,n): for i in range(N-2**j+1): _GCD[i][j]=gcd(_GCD[i][j-1],_GCD[i+2**(j-1)][j-1]) def GCD(l,r): b=r-l+1 m=b.bit_length()-1 return gcd(_GCD[l][m],_GCD[r-2**m+1][m]) res=0 for i in range(N): start=i end=N-1 while end-start>1: t=(end+start)//2 if GCD(i,t)==1: end=t else: start=t if GCD(i,start)==1: res+=N-start elif GCD(i,end)==1: res+=N-end print(res)