 N = gets.to_i
 array = gets.split.map(&:to_i)
 count = 0
 array.combination(3).each do |a, b, c|
   if a != b && b != c && a != c && a + b > c && b + c > a && c + a > b
     count += 1
   end
 end

 puts count
