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
Ankit Sultana:
20150207 16:25:06
Changed int *arr; arr = new int[n]; to int arr[11100] = {0}; and got AC in less than 2 seconds. 

Rang:
20150206 17:03:10
like others have said. tight constraints. be frugal:)(I guess the author wanted an O(N^3) solution)


Bezzam Varun:
20150204 13:27:59
Some useful points:Don't use vectors. Sort the arrays using STL and check for d!=0 always. Also, there's no need to use binary search. Use a modified version of mergesort algo. AC after 4.5 hours! 

Jordan Alexander:
20150201 00:13:44
If anyone else is having problems with the image, the Wayback Machine archived a copy of the problem back when the image still worked. 

Anvesh Kumar Arrabochu:
20150116 09:31:14
Can be solved in O(N^3). Hint(C++): unordered_map 

eightnoteight:
20150114 14:25:17
don't forget to read Make In India!'s note.. costed me 3 WA


Faisal Ahmed:
20150107 08:24:34
"Error


sirius:
20150105 14:36:08
Im getting time limit exceeded for case 11,anyone knows why? 

Vinay:
20141213 18:56:04
used quick sort and binary search still got TLE for 11th case :/ 

HARINDER SINGH:
20141122 17:06:17
used map got TLE

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 