import sys input = sys.stdin.readline from math import gcd n = int(input()) a = list(map(int,input().split())) def judge(ls): l = len(ls) if l == 1: if ls[0] == 1: return 1 else: return 0 ret = judge(ls[:l//2])+judge(ls[l//2:]) stack1 = [ls[l//2-1]] stack2 = [ls[l//2]] for i in range(l//2): if l//2-i-2 >= 0: stack1.append(gcd(ls[l//2-i-2],stack1[-1])) if i+l//2+1 <= l-1: stack2.append(gcd(ls[i+l//2+1],stack2[-1])) s1l = len(stack1) s2l = len(stack2) lf = s1l-1 r = 0 for r in range(s2l): while lf >= 0 and gcd(stack1[lf],stack2[r]) == 1: ret += s2l-r if lf > 0: lf -= 1 else: break if gcd(stack1[lf],stack2[r]) == 1: break return ret print(judge(a))