gets A = gets.split.map(&:to_i) C = A.group_by{|n| n}.map{|n,a| [n, a.size]} ans = 0 C.combination(3) do |a| ans += a.map{|nc| nc[1]}.inject(&:*) end puts ans