require 'prime' N = gets.to_i A = gets.split.map(&:to_i) dp = Array.new(N) { Hash.new(0) } ans = 0 N.times do |i| dp[i][A[i]] += 1 (i + 1).upto(N - 1) do |j| dp[i].each do |e, cnt| dp[j][e.gcd(A[j])] += cnt end end ans += dp[i][1] end puts ans