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