A satellite telemetry stream reports n integer samples in order. Count the number of triples of positions (i, j, k) with i < j < k such that sample[i] < sample[j] < sample[k] — that is, the number of strictly increasing subsequences of length exactly three. Two triples are different if they use different sets of positions (values may repeat).
Input format
Line 1: an integer n.
Line 2: n space-separated integers, the samples in order.
Output format
A single integer: the count of strictly increasing length-3 subsequences.
Constraints
- 1 <= n <= 3000
- -1000000000 <= sample <= 1000000000
- The answer fits in a signed 64-bit integer.