n = gets.to_i
arr = gets.split(" ").map(&:to_i).sort

count = 0
n.times do |i|
  (n-i-1).times do |i2|
    j = i2 + i + 1
    (n-i-i2-1).times do |i3|
      k = i3 + i2 + i + 1
      if i != j && j != k && k != i && arr[i] != arr[j] && arr[j] != arr[k] && arr[k] != arr[i] && arr[i] + arr[j] > arr[k]
        count += 1
      end
    end
  end
end
      
puts count
