import sys import math from collections import defaultdict def main(): n = int(sys.stdin.readline()) a = list(map(int, sys.stdin.readline().split())) total = 0 prev = dict() for num in a: curr = defaultdict(int) # Process previous GCDs for g in prev: new_g = math.gcd(g, num) curr[new_g] += prev[g] # Add the current number as a single-element subarray curr[num] += 1 # Update total total += curr.get(1, 0) # Update prev for next iteration prev = curr print(total) if __name__ == "__main__": main()