# frozen_string_literal: true def solve A.combination(3).select { |a| a.reduce(:gcd) == 1 }.size end N = gets.to_i A = N.times.map { gets.to_i } puts solve