There is an integer array which does not contain more than two elements of the same value. How many distinct ascending triples () are present?
The first line contains an integer, , denoting the number of elements in the array. This is followed by a single line, containing space-separated integers. Please note that there are no leading spaces before the first number, and there are no trailing spaces after the last number.
A single integer that denotes the number of distinct ascending triplets present in the array.
Every element of the array is present at most twice.
Every element of the array is a 32-bit non-negative integer.
1 1 2 2 3 4
The distinct triplets are
The elements of the array might not be sorted. Make no assumptions of the same.