import sys import math from collections import defaultdict def main(): data = sys.stdin.read().split() n = int(data[0]) a = list(map(int, data[1:n+1])) total = 0 prev_gcd = {} # Initialized as an empty dictionary for num in a: current_gcd = defaultdict(int) # Process previous GCDs for g in prev_gcd: new_g = math.gcd(g, num) current_gcd[new_g] += prev_gcd[g] # Add the current number itself as a subarray current_gcd[num] += 1 # Accumulate the count of subarrays with GCD 1 total += current_gcd.get(1, 0) # Update prev_gcd for the next iteration prev_gcd = dict(current_gcd) print(total) if __name__ == "__main__": main()