n = gets.to_i
ls = gets.split(' ').map(&:to_i)
counts = ls.group_by(&:itself).map {|k, v| [k, v.size] }.to_h
nums = counts.keys.sort
N = nums.length

cnt = 0
(0...N).each do |i|
  (0...i).each do |j|
    (j + 1...i).each do |k|
      if nums[i] < nums[j] + nums[k]
        cnt += counts[nums[i]] * counts[nums[j]] * counts[nums[k]]
      end
    end
  end
end
puts cnt
