#!/usr/bin/env ruby
n = gets.chomp.to_i
inputs = gets.chomp.split(' ').map(&:to_i)
result = 0

inputs.each_with_index do |input, i|
  j = i + 1
  while j < n
    m = j + 1
    while m < n
      if [inputs[i], inputs[j], inputs[m]].uniq.length == 3 &&
        inputs[i] < inputs[j] + inputs[m] && inputs[j] < inputs[m] + inputs[i] && inputs[m] < inputs[j] + inputs[i]
        result += 1
      end
      m += 1
    end
    j += 1
  end
end

puts result
