import sys from math import gcd from collections import defaultdict def main(): n = int(sys.stdin.readline()) a = list(map(int, sys.stdin.readline().split())) total = 0 prev_gcds = defaultdict(int) for num in a: curr_gcds = defaultdict(int) # Process each GCD from the previous step for g, cnt in prev_gcds.items(): new_g = gcd(g, num) curr_gcds[new_g] += cnt # Add the subarray consisting of just the current number curr_gcds[num] += 1 # Check if any GCD is 1 and add to total if 1 in curr_gcds: total += curr_gcds[1] # Update prev_gcds for the next iteration prev_gcds = curr_gcds print(total) if __name__ == "__main__": main()