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
jainnamah: 2021-11-21 16:37:20

AC in a go :) Basic hashing (note d != 0)

thedatageek: 2021-10-16 14:11:37

Can we use same number multiple times?

mr_non_beast12: 2021-08-18 08:30:10

this is something

yasser1110: 2021-07-22 13:34:35

Watch out for d != 0 condition. Gave me a WA in first attempt.

thegreatpd: 2021-07-06 14:10:30

As,n=100,O(n^4) solution should pass. But I'm getting tle. Why?

jatin007: 2021-05-24 08:19:33

I've solved this problem for n^2 time complexity but its time limit should be increased for java. this problem is from 2009 so it might have same time limit for any language

vasumath_1351: 2021-05-16 19:30:41

Instead of Python submit the same code in PyPy 2.7 i got accepted ;)

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


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