
def triangle a, b, c
  if a < b+c
    if b < a+c
      if c < a+b
        return true
      end
    end
  end
  return false
end

n = gets.to_i
arr = gets.split.map(&:to_i)

x = 0
hash = { }

n.times do |i|
  n.times do |j|
    next if arr[i] == arr[j]
    n.times do |k|
      next if arr[i] == arr[k]
      next if arr[j] == arr[k]
      str = [i,j,k].sort.map(&:succ).to_s
      unless hash.has_key? str
        hash[str] = triangle arr[i], arr[j], arr[k]
        if hash[str]
          x += 1
        end
      end
    end
  end
end

puts x
