def triangular(x,y,z)
  return x+y>z && y+z>x && z+x>y
end

n=gets.to_i
ln=gets.split(' ').map(&:to_i)
res=0
(0...n).each do |i|
  (i+1...n).each do |j|
    next if ln[i]==ln[j]

    (j+1...n).each do |k|
      next if ln[i]==ln[k] || ln[j]==ln[k]

      if triangular(ln[i],ln[j],ln[k])
        res += 1
      end
    end
  end
end
p res