n = gets.to_i
l = gets.split.map(&:to_i).sort
count = 0
#p l 

(0..n-2).each { |a| # short
  (a+1..n).each { |b| # short
    (b+1..n).each { |c| # long
      #      puts "a:#{a} la:#{l[a]} b:#{b} lb:#{l[b]} c:#{c} lc:#{l[c]}"
      next if (l[a].nil? || l[b].nil? || l[c].nil? )
      next if l[a] == l[b] || l[a] == l[c] || l[b]  == l[c] 
      #count+= 1 if ( (l[b] - l[c]).abs < l[a] ) && ( l[a] < l[b] + l[c] )
      count+= 1 if l[c] < l[a] + l[b]
      #      puts "GOT!!!"
    }
  }
}

puts count
