_n = gets
L = gets.split("\s").map(&:to_i).sort
count = 0

0.step (L.size-1) do |l1|
  (l1+1).step (L.size-1) do |l2|
    (l2+1).step (L.size-1) do |l3|
      if L[l1] + L[l2] > L[l3] && L[l1] != L[l2] && L[l2] != L[l3]
        count += 1
      end
    end
  end
end

p count
        