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
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
2020-08-16 15:54:22
Probably hashmap should also be a added as a tag
2020-07-31 18:07:13
solve SUMFOUR problem ..similar to this;
2020-07-31 18:06:03
finally AC using vector ,sorting , lower_bound & upper_bound..but it took 2+ sec...& time limit is 1sec;
2020-06-09 19:08:06
getting TLE while using python help!!
2020-05-27 20:09:19
A very nice problem!
2020-05-23 16:54:19
after 4 months, i tried this problem again..but this time i used vectors..
ac in 1.21sec ;)
2020-05-21 07:46:37
just use map stl
map_1[a*b+c]++ , map_2[d+e*f]++
2020-05-19 15:12:50
use map
2020-05-06 21:23:53
Python submission.Getting TLE for N^3(3logN)

Last edit: 2020-05-06 21:24:20
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.