ABCDEF - ABCDEF


You are given a set S of integers between -30000 and 30000 (inclusive).

Find the total number of sextuples  that satisfy: 

 

Input

The first line contains integer N (1 ≤ N ≤ 100), the size of a set S.

Elements of S are given in the next N lines, one integer per line. Given numbers will be distinct.

Output

Output the total number of plausible sextuples.

Examples

Input:
1
1

Output:
1
Input:
2
2
3

Output:
4
Input:
2
-1
1

Output:
24
Input:
3
5
7
10

Output:
10



hide comments
bro_itsme: 2020-05-04 16:25:21

works with hashmap too with time O(n^3+2n) and space O(n^3).

Last edit: 2020-05-04 16:25:42
sutharp777: 2020-03-19 20:12:47

AC in one go!
the funda is work on duplicate elements in array in which we search for element by upper_bound()- lowerbound() is total count of that elements
greate problem.

zerodark: 2020-02-11 13:07:24

Remember d!=0

nfpranta: 2020-02-07 19:04:43

Why do need to find the occurrences of each element in the rhs and add this to result..How is it related to the problem statement?

sangmai: 2020-02-01 02:10:46

AC with N^3*(3logN+2)

ayushagrwl_19: 2020-01-04 07:52:34

Finally!!!! done after long time
use (a*b)+c=(f+e)*d ,d!=0 and binary search

apurv_19: 2019-12-25 15:14:49

finally AC ..after 8 WA and 6 TLE..
use vectors.... upper bound, lower bound

Last edit: 2019-12-27 10:22:11
scolar_fuad: 2019-11-03 17:49:39

O(n^3)+binary search it took 4 month to solve for me

anujkurmi7105: 2019-10-15 20:47:52

Don't use vectors, use arrays,int instead of long long

harshraj22aug: 2019-09-28 12:47:43

WTF !! Someone explain the question settler that (a/b==c) and (a==b*c) are not always equal !!


Added by:Luka Kalinovcic
Date:2009-07-13
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:own problem