import sys import math def main(): n = int(sys.stdin.readline()) A = list(map(int, sys.stdin.readline().split())) result = 0 prev = {} for a in A: if a == 1: count = sum(prev.values()) + 1 result += count prev = {1: count} continue temp = {a: 1} prev_list = list(prev.items()) for g, cnt in prev_list: new_g = math.gcd(g, a) if new_g in temp: temp[new_g] += cnt else: temp[new_g] = cnt if 1 in temp: result += temp[1] prev = temp print(result) if __name__ == "__main__": main()