Yasin has an array *a* containing *n* integers. Yasin is a 5 year old, so he loves ultimate weird things.

Yasin denotes weirdness of an array as maximum *gcd*(*a*<sub class="lower-index">*i*</sub>,  *a*<sub class="lower-index">*j*</sub>) value among all 1 ≤ *i* &lt; *j* ≤ *n*. For *n* ≤ 1 weirdness is equal to 0, *gcd*(*x*,  *y*) is the greatest common divisor of integers *x* and *y*.

He also defines the ultimate weirdness of an array. Ultimate weirdness is <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/6ef04f31fc88d23b93e68a317d597db92d1375da.png" style="max-width: 100.0%;max-height: 100.0%;"/> where *f*(*i*,  *j*) is weirdness of the new array *a* obtained by removing all elements between *i* and *j* inclusive, so new array is [*a*<sub class="lower-index">1</sub>... *a*<sub class="lower-index">*i* - 1</sub>, *a*<sub class="lower-index">*j* + 1</sub>... *a*<sub class="lower-index">*n*</sub>].

Since 5 year old boys can't code, Yasin asks for your help to find the value of ultimate weirdness of the given array *a*!
The first line of the input contains a single integer *n* (1 ≤ *n* ≤ 200 000) — the number of elements in *a*.

The next line contains *n* integers *a*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 200 000), where the *i*-th number is equal to the *i*-th element of the array *a*. It is guaranteed that all *a*<sub class="lower-index">*i*</sub> are distinct.
Consider the first sample.
 -  *f*(1,  1) is equal to 3. -  *f*(2,  2) is equal to 1. -  *f*(3,  3) is equal to 2. -  *f*(1,  2), *f*(1,  3) and *f*(2,  3) are equal to 0.
class STree:

    def __init__(self,l,r):
        self.mn=0
        self.mx=0
        self.sum=0
        self.tag=-1
        if l==r:
            self.lc=None
            self.rc=None
        else:
            mid=(l+r)//2
            self.lc=STree(l,mid)
            self.rc=STree(mid+1,r)

    def setg(self,l,r,x):
        self.mn=self.mx=x
        self.sum=(r-l+1)*x
        self.tag=x
        
    def update(self):
        self.mn=min(self.lc.mn,self.rc.mn)
        self.mx=max(self.lc.mx,self.rc.mx)
        self.sum=self.lc.sum+self.rc.sum
    
    def pushdown(self,l,r):
        if self.tag==-1: return
        mid=(l+r)//2
        self.lc.setg(l,mid,self.tag)
        self.rc.setg(mid+1,r,self.tag)
        self.tag=-1
    
    def modify(self,l,r,ql,qr,x):
        if self.mn>=x: return
        if ql<=l and r<=qr and self.mx<=x:
            self.setg(l,r,x); return
        mid=(l+r)//2
        self.pushdown(l,r)
        if ql<=mid: self.lc.modify(l,mid,ql,qr,x)
        if mid+1<=qr: self.rc.modify(mid+1,r,ql,qr,x)
        self.update()
    
    def query(self,l,r,ql,qr):
        if ql<=l and r<=qr: return self.sum
        mid=(l+r)//2
        self.pushdown(l,r)
        res=0
        if ql<=mid: res+=self.lc.query(l,mid,ql,qr)
        if mid+1<=qr: res+=self.rc.query(mid+1,r,ql,qr)
        return res

if __name__ == "__main__":
    n=int(input())
    a=list(map(int,input().split()))
    mx=0
    for x in a: mx=max(mx,x)
    dd=[]
    for i in range(mx+1): dd.append([])
    for i in range(1,mx+1):
        for j in range(i,mx+1,i):
            dd[j].append(i)
    tmp=[]
    for i in range(mx+1): tmp.append([])
    for i in range(n):
        for x in dd[a[i]]:
            tmp[x].append(i)
    lis=[]
    for i in range(mx+2): lis.append([])
    for x in range(1,mx+1):
        l=len(tmp[x])
        if l<2: continue
        lis[tmp[x][1]+1].append((n-1,x))
        lis[0].append((tmp[x][l-2]-1,x))
        lis[tmp[x][0]+1].append((tmp[x][l-1]-1,x))
    T=STree(0,n-1)
    ans=0
    for i in range(0,n):
        for x,y in lis[i]:
            if x<0: continue
            T.modify(0,n-1,0,x,y)
        ans+=T.query(0,n-1,i,n-1)
    print(ans)