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



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

hide comments
2015-08-17 14:04:22 shantanu tripathi
done without maps.... gud use of bs...O(n^3*log(n))...
2015-08-12 08:53:04 Medo
if you are using a map and getting TLE, then change it to unordered_map.

Last edit: 2015-08-12 08:55:15
2015-07-29 01:26:51 sarvagya
@Souvik-> check if d is zero
2015-07-29 01:25:53 sarvagya
equal_range in STL <3
nice question!

Last edit: 2015-07-29 01:26:14
2015-07-27 14:58:12 Souvik Mondal
Getting TLE on 11th case.O(n^3logn).any help?

Last edit: 2015-07-27 15:00:00
2015-07-25 08:29:15 Rahul Jain
I think truncation(rounding up) is not allowed while dividing by 'd'.
2015-06-24 20:42:22 Liquid_Science
In java problem shows NZEC instead of tle, whole day wasted -_-
please see into it.
2015-06-12 21:07:54 sujit yadav
very easy O(logn*n^3) AC !! :)

2015-06-09 06:08:07 xxbloodysantaxx
No STL s , simple implementation of Lower bound and upper bound :)
2015-05-16 10:56:29 Shubham Jalan
TLE for std::map and ac for unordered_map!
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.