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
sachin_19: 2020-05-21 07:46:37

just use map stl
map_1[a*b+c]++ , map_2[d+e*f]++

deepkamal: 2020-05-19 15:12:50

use map

sacsachin: 2020-05-06 21:23:53

Python submission.Getting TLE for N^3(3logN)

Last edit: 2020-05-06 21:24:20
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

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