Magic Pairs

All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian.
Alexandra has some distinct integer numbers a_{1},a_{2}...a_{n}. Count number of pairs (i,j) such that:
Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.The first line of each test case contains a single integer n denoting the number of numbers Alexandra has. The second line contains n spaceseparated distinct integers a_{1}, a_{2}, ..., a_{n} denoting these numbers.
Output
For each test case, output a single line containing number of pairs for corresponding test case.
Constraints
 1 ≤ T ≤ 4
 1 ≤ n ≤ 100000
 0 ≤ a_{i} ≤ 10^{9}
 All the a_{i} are distinct
Example
2 2 2 1 3 3 1 2Output:
1 3
Explanation
Case 1: Only one such pair: (2,1)
Case 2: 3 possible pairs: (2,1), (2,3), (3,1)
.Author:  ballon_ziq 
Tester:  gerald 
Editorial  http://discuss.codechef.com/problems/ALEXNUMB 
Tags  ballon_ziq, dec13, easy 
Date Added:  5112013 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 