n=gets.to_i
a=gets.split.map(&:to_i).sort
cnt=0
n=a.size
for i in 0...n-2
  for j in i+1...n-1
    for k in j+1...n
      if a[i]+a[j]>a[k]&&(!(a[i]==a[j]||a[j]==a[k]))
        cnt+=1
      end
    end
  end
end
puts cnt
