import math import sys def main(): input = sys.stdin.read().split() n = int(input[0]) a = list(map(int, input[1:n+1])) res = 0 prev_gcds = [] # List of tuples (g, count) for x in a: if x == 1: current_count = sum(cnt for g, cnt in prev_gcds) + 1 res += current_count prev_gcds = [(1, current_count)] else: curr = {} # Handle current element alone curr[x] = 1 # Handle previous elements for g, cnt in prev_gcds: new_g = math.gcd(g, x) if new_g in curr: curr[new_g] += cnt else: curr[new_g] = cnt # Add the count of 1 to the result res += curr.get(1, 0) # Update prev_gcds prev_gcds = list(curr.items()) print(res) if __name__ == "__main__": main()