#K43782. Counting Strictly Increasing Subsequences of Length 3

    ID: 27386 Type: Default 1000ms 256MiB

Counting Strictly Increasing Subsequences of Length 3

Counting Strictly Increasing Subsequences of Length 3

Given a sequence of n integers representing daily temperatures, your task is to find the number of strictly increasing subsequences of length 3.

A subsequence of length 3 is defined as a triplet of indices i, j, k such that \(1 \le i < j < k \le n\) and the corresponding elements satisfy \(a[i] < a[j] < a[k]\). Use the input from standard input and output the answer to standard output.

Example:

Input:
6
2 5 3 4 1 6
Output:
5

inputFormat

The first line contains an integer \(n\) representing the number of elements in the sequence. The second line contains \(n\) space-separated integers representing the sequence.

outputFormat

Output a single integer, the number of strictly increasing subsequences of length 3.

## sample
6
2 5 3 4 1 6
5