#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

## Problem Description

After successfully assigning his *N* participants to groups and completing the activity, Damian now has them back in single file.

Of course, each student has his/her own height *H _{i}*, making the line lack uniformity and thus look rather messy.

Damian wants to quantify just how messy the line is. Thus, he wants to know how many triplets of students *i*, *j*, *k* exist, where *i* < *j* < *k* in the line and *H _{i}* >

*H*>

_{j}*H*.

_{k}## Input

The first line contains one integer, *N*, the number of participants.

The second line contains *N* space-separated integers, with the *i*th integer representing the height of the *i*th participant.

## Output

The output should contain one line containing one integer, the number of such triplets.

## Limits

For all subtasks, 1 ≤ *H _{i}* ≤ 10

^{9}.

Subtask 1 (19%): 1 ≤ *N* ≤ 500.

Subtask 2 (35%): 1 ≤ *N* ≤ 10 000.

Subtask 3 (46%): 1 ≤ *N* ≤ 10^{6}.

Subtask 4 (0%): Sample Testcases.

## Sample Testcase 1

### Input

5 9 3 7 4 1

### Output

5

## Sample Testcase 1 Explanation

The triplets are {9, 3, 1}, {9, 7, 4}, {9, 7, 1}, {9, 4, 1} and {7, 4, 1}.

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 19 | 11 | 1s | 256MB | Minimum |

2 | 35 | 21 | 1s | 256MB | Minimum |

3 | 46 | 31 | 1s | 256MB | Minimum |

4 | 0 | 1 | 1s | 256MB | Minimum |

### Judge Compile Command

g++-7 ans.cpp -o singlefile -Wall -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512