#d2742. 喵喵序列
喵喵序列
Meow Sequence
Problem Description
Given a sequence of integers , a triple is called cute if and only if and .
Count how many cute triples there are.
Input Format
The first line contains an integer : the number of elements in the sequence.
The second line contains integers .
Output Format
Output one integer: the number of cute triples.
Sample Input
5
1 2 2 3 4
Sample Output
7
Sample Explanation
The valid triples are , , , , , , , in total.
Constraints
, .