#P1637. 三元上升子序列
三元上升子序列
Description
Erwin has recently become very interested in something called thair...
In a sequence with integers , three numbers are called thair if and only if and .
Find the number of thair in the sequence.
Input Format
The first line contains a positive integer .
The second line contains integers .
Output Format
Print one integer in a single line indicating the number of thair.
4
2 1 3 4
2
5
1 2 2 3 4
7
Hint
Sample 2 Explanation
The thair are:
- 1 2 3.
- 1 2 4.
- 1 2 3.
- 1 2 4.
- 1 3 4.
- 2 3 4.
- 2 3 4.
Constraints
- For of the testdata, it is guaranteed that .
- For of the testdata, it is guaranteed that .
- For of the testdata, it is guaranteed that and .
Translated by ChatGPT 5
京公网安备 11011102002149号