while
  n = gets
  if ! n then
    exit
  end
  n=n.chomp.to_i

  ls = gets.chomp.split(' ').map { | x | x.to_i}

  count = 0
  ls.combination(3).to_a.uniq.each { | a,b,c |
    a,b,c = [a,b,c].sort { | x,y | y <=> x}
#    p [a,b,c]
    if (a < b+c) then
#      p [a,b,c]
      count = count + 1
    end
  }
  puts count

end

