import math from collections import defaultdict n = int(input()) a = list(map(int, input().split())) total = 0 prev_gcds = defaultdict(int) for num in a: curr_gcds = defaultdict(int) curr_gcds[num] = 1 for g in prev_gcds: new_g = math.gcd(g, num) curr_gcds[new_g] += prev_gcds[g] total += curr_gcds.get(1, 0) prev_gcds = curr_gcds print(total)