import sys import math def main(): input = sys.stdin.read().split() n = int(input[0]) A = list(map(int, input[1:n+1])) total = 0 prev_gcd = {} for num in A: current_gcd = {} # Process each GCD from the previous step for g in prev_gcd: cnt = prev_gcd[g] new_g = math.gcd(g, num) if new_g in current_gcd: current_gcd[new_g] += cnt else: current_gcd[new_g] = cnt # Add the current number as a new subarray if num in current_gcd: current_gcd[num] += 1 else: current_gcd[num] = 1 # Update the total with the count of GCD 1 if 1 in current_gcd: total += current_gcd[1] # Set current_gcd as prev_gcd for the next iteration prev_gcd = current_gcd print(total) if __name__ == '__main__': main()