n = gets.to_i
l = gets.split.map(&:to_i).sort
cnt = 0
c = 0
0.upto(n - 1) do |i|
  i.next.upto(n - 1) do |j|
    next if l[i] == l[j]
    j.next.upto(n - 1) do |k|
      cnt += 1 if l[i] + l[j] > l[k] && l[j] < l[k]
      c += 1
    end
  end
end
puts cnt