Zero quintuples#7448

Zero quintuples

1 saniye
128 megabayt
Orta

You are given a sequence of distinct integers a_1, a_2, \dots, a_n.

A zero quintuple is a set of five elements a_i, a_j, a_k, a_p, a_q such that i < j < k < p < q and

a_i + a_j + a_k + a_p + a_q = 0

Find the number of different zero quintuples in the given sequence.

Giriş

The first line contains an integer n~(5 \le n \le 2000) — the number of elements in the sequence.

The second line contains distinct integers a_1, a_2, \dots, a_n~(-10000 \le a_i \le 10000) — the elements of the sequence.

Çıktı

Print one integer — the number of zero quintuples in the given sequence.

Örnekler

Örnek 1

Loading
Loading