import math def main(): import sys input = sys.stdin.read data = input().split() n = int(data[0]) A = list(map(int, data[1:n+1])) result = 0 prev_list = [] for num in A: curr_dict = {} # Add the current element as a single-element subarray if num in curr_dict: curr_dict[num] += 1 else: curr_dict[num] = 1 # Process each (g, cnt) in prev_list for g, cnt in prev_list: new_g = math.gcd(g, num) if new_g in curr_dict: curr_dict[new_g] += cnt else: curr_dict[new_g] = cnt # Check if 1 is in curr_dict if 1 in curr_dict: result += curr_dict[1] # Prepare prev_list for next iteration prev_list = [] for g in curr_dict: prev_list.append((g, curr_dict[g])) print(result) if __name__ == "__main__": main()