F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

World is Exploding

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1732    Accepted Submission(s): 819


Problem Description
Given a sequence A with length n,count how many quadruple (a,b,c,d) satisfies: $a \neq b \neq c \neq d, 1 \leq a < b \leq n, 1 \leq c < d \leq n, A_{a} < A_{b}, A_{c} > A_{d}$.
 

Input
The input consists of multiple test cases.
Each test case begin with an integer n in a single line.

The next line contains n integers $A_{1},A_{2}\cdots A_{n}$.
$1 \leq n \leq 50000$
$0 \leq A_{i} \leq 1e9$
 

Output
For each test case,output a line contains an integer.
 

Sample Input
4 2 4 1 3 4 1 2 3 4
 

Sample Output
1 0
 

Author
ZSTU
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-10 08:46:39, Gzip enabled