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
jainnamah:
20211121 16:37:20
AC in a go :) Basic hashing (note d != 0) 

thedatageek:
20211016 14:11:37
Can we use same number multiple times?


mr_non_beast12:
20210818 08:30:10
this is something 

yasser1110:
20210722 13:34:35
Watch out for d != 0 condition. Gave me a WA in first attempt. 

thegreatpd:
20210706 14:10:30
As,n=100,O(n^4) solution should pass. But I'm getting tle. Why? 

jatin007:
20210524 08:19:33
I've solved this problem for n^2 time complexity but its time limit should be increased for java. this problem is from 2009 so it might have same time limit for any language 

vasumath_1351:
20210516 19:30:41
Instead of Python submit the same code in PyPy 2.7 i got accepted ;)


thelegend2710:
20210219 08:56:29
How does this uses binary search?


kya_bantai:
20201203 16:16:38
mappp 

kanishkverma_1:
20201128 11:09:08
simple brute force with hashmap , handle the d == 0 case explicitly

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