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
Khairo21:
20170406 14:11:47
Good Problem on Meet in the Middle Technique :)


giorgosgiapis:
20170404 21:41:16
Easy one. Upper and lower bound will make your life easier! 

crusader_3197:
20170402 08:38:14
how do the top guys got the solution accepted in 0.02s? 

sunny:
20170401 12:46:06
careful about d!=0 :) 

sunny:
20170401 12:46:00
careful about d!=0 :) 

vineetpratik:
20170327 09:34:47
upper_bound, lower_bound / binary search and d!=0. 

nilabja16180:
20170303 10:00:47
1.85 sec, still it passes! 

vladimira:
20170228 02:20:46
Some hate comments bcs of TLEs =)) But I think its a good problem for two reasons: 1  simple arithmetic formula gives so many ways of making an algorithm 2  makes you understand how to code same thing in fastest way 

cake_is_a_lie:
20170215 03:14:05
So many chances to get bugs on this one SIGFPE > SIGSEGV > WAs (curse you operator %; why don't you learn some math?!), but finally AC in 0.36s; no binary search just iterating over a, b, d and some lookup tables.


holmesherlock:
20170202 21:32:04
"d!=0" gave me too many WA 
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 