#P2165. [AHOI2009] 飞行棋

[AHOI2009] 飞行棋

Description

Given several points on a circle and the arc lengths between consecutive points in circular order (each a positive integer), determine how many distinct rectangles can be formed by choosing four of these points as vertices.

Input Format

The first line contains a positive integer NN, the number of points. Each of the next NN lines gives the length of the arc between consecutive points along the circle, in circular order.

Output Format

Output a single integer: the number of distinct rectangles formed.

8
1
2
2
3
1
1
3
3

3

Hint

N20N \le 20

Translated by ChatGPT 5