def gcd(x,y): while x%y: x,y=y,x%y return y def bb(l,r): res=seg[l] while l1: w=gcd(a[q],w);q+=1 if w==1: ans+=n-q+1 print(ans)