#C2050. Count Strictly Increasing Triplets

    ID: 45324 Type: Default 1000ms 256MiB

Count Strictly Increasing Triplets

Count Strictly Increasing Triplets

Given an array of integers representing chemical concentration data points, your task is to count the number of strictly increasing sequences of length 3.

Formally, you need to count the number of triplets (i, j, k) satisfying the conditions:

$$ i < j < k \quad \text{and} \quad a_i < a_j < a_k $$

For example, if the array is [1, 2, 3, 4, 1, 2], there are 4 such triplets.

inputFormat

The input is given via stdin and consists of two parts:

  • The first line contains a single integer n denoting the size of the array.
  • The second line contains n space-separated integers representing the elements of the array.

outputFormat

Output a single integer on stdout which is the number of strictly increasing triplets (i.e. sequences of length 3) found in the array.

## sample
6
1 2 3 4 1 2
4

</p>