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
shantanu tripathi: 2015-08-17 14:04:22

done without maps.... gud use of bs...O(n^3*log(n))...

Medo: 2015-08-12 08:53:04

if you are using a map and getting TLE, then change it to unordered_map.

Last edit: 2015-08-12 08:55:15
sarvagya: 2015-07-29 01:26:51

@Souvik-> check if d is zero

sarvagya: 2015-07-29 01:25:53

equal_range in STL <3
nice question!

Last edit: 2015-07-29 01:26:14
Souvik Mondal : 2015-07-27 14:58:12

Getting TLE on 11th case.O(n^3logn).any help?

Last edit: 2015-07-27 15:00:00
Rahul Jain: 2015-07-25 08:29:15

I think truncation(rounding up) is not allowed while dividing by 'd'.

Liquid_Science: 2015-06-24 20:42:22

In java problem shows NZEC instead of tle, whole day wasted -_-
please see into it.

sujit yadav: 2015-06-12 21:07:54

very easy O(logn*n^3) AC !! :)

xxbloodysantaxx: 2015-06-09 06:08:07

No STL s , simple implementation of Lower bound and upper bound :)

Shubham Jalan: 2015-05-16 10:56:29

TLE for std::map and ac for unordered_map!


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