MOD = 10 ** 9 + 7 INF = 10 ** 10 import sys sys.setrecursionlimit(100000000) dy = (-1,0,1,0) dx = (0,1,0,-1) from collections import deque from heapq import heapify,heappush,heappop from math import gcd from copy import deepcopy def main(): n = int(input()) a = list(map(int,input().split())) dpnow = {a[0]:1} dpbefore = {a[0]:1} for i in range(1,n): num = a[i] dpbefore = deepcopy(dpnow) for g in dpbefore: newg = gcd(g,num) if newg in dpnow: dpnow[newg] += dpbefore[g] else: dpnow[newg] = dpbefore[g] if num in dpnow: dpnow[num] += 1 else: dpnow[num] = 1 if 1 in dpnow: print(dpnow[1]) else: print(0) if __name__ == '__main__': main()