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
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 !!

sonuexpc: 2019-09-28 11:25:16

Be careful with d!=0 ;)

Last edit: 2019-09-28 11:26:27
payal2621: 2019-08-06 17:09:17

you traverse through each element of the set using three loops to assign all the possible value to LHS and RHS
avoiding d=0, use one vector for LHS and another vector for rhs values, sort both the vectors,
traverse through LHS and find the occurrence of each element in RHS and add this to result print result, you can find occurrence using lower bound and upper bound
use vectors no need for an unordered map

siddharthvp: 2019-07-30 18:44:26

Are a,b,c,d,e,f distinct?

divergent42: 2019-07-04 14:54:42

Easy question..lower bound and upper bound is the key to solve this

anshika_85: 2019-07-04 07:03:01

nice!!!

yashranjan74: 2019-06-20 08:55:01

Just make sure to check for d==0 case and maintain complexity of O(N^3) at max.

hetp111: 2019-05-31 15:19:16

sexy


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