import sys import math def main(): n = int(sys.stdin.readline()) a_list = list(map(int, sys.stdin.readline().split())) res = 0 prev = {} for a in a_list: curr = {} # Process previous GCDs for g, cnt in prev.items(): new_g = math.gcd(g, a) if new_g in curr: curr[new_g] += cnt else: curr[new_g] = cnt # Add the current element as a new subarray new_g = a if new_g in curr: curr[new_g] += 1 else: curr[new_g] = 1 # Accumulate the count of GCD 1 res += curr.get(1, 0) # Update prev for next iteration prev = curr print(res) if __name__ == "__main__": main()