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
thelegend2710: 2021-02-19 08:56:29

How does this uses binary search?

kya_bantai: 2020-12-03 16:16:38

mappp

kanishkverma_1: 2020-11-28 11:09:08

simple brute force with hashmap , handle the d == 0 case explicitly

lamda_cdm_10: 2020-11-20 17:22:16

AC in one go... A beautiful question, try solving the "4 SUM 0" problem first, and then try this one.

Last edit: 2020-11-20 17:23:21
legion0retr0: 2020-08-16 15:54:22

Probably hashmap should also be a added as a tag

wille_25: 2020-07-31 18:07:13

solve SUMFOUR problem ..similar to this;

wille_25: 2020-07-31 18:06:03

finally AC using vector ,sorting , lower_bound & upper_bound..but it took 2+ sec...& time limit is 1sec;

jha_saurav: 2020-06-09 19:08:06

getting TLE while using python help!!

jintu_133: 2020-05-27 20:09:19

A very nice problem!

tarun_28: 2020-05-23 16:54:19

after 4 months, i tried this problem again..but this time i used vectors..
ac in 1.21sec ;)


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