lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]
edges = lines[1].sort

ans = 0
for i in 1..(N-2) do
  for j in (i+1)..(N-1) do
    for k in (j+1)..N do
      if edges[i-1] != edges[j-1] and edges[j-1] != edges[k-1] and edges[k-1] != edges[i-1] then
        if edges[i-1] + edges[j-1] > edges[k-1] then
          ans += 1
        end
      end
    end
  end
end
puts ans