lines = readlines.map{|line| line.split(' ').map(&:to_i)}
a = lines[1].sort.combination(2).to_a
b = 0
for k in 0..a.length-1
  for i in 0..lines[1].length-1
    j = lines[1][i]
    if j<a[k][0] && j+a[k][0]>a[k][1] && j+a[k][1]>a[k][0] && a[k][0]+a[k][1]>j then
      b = b + 1
    end
  end
end
p b