#P10088. Big Triangle Formation
Big Triangle Formation
Big Triangle Formation
Given n triangles, each with an integer value representing a special vertex angle (in degrees). Four distinct triangles can form a big triangle if and only if one of the triangles' vertex angle is equal to the sum of the vertex angles of the other three. Two sets are considered different if there exists at least one triangle present in one set and not in the other.
The condition for four triangles with vertex angles \(a, b, c, d\) to form a big triangle is:
\[ a = b + c + d \quad or \quad b = a + c + d \quad or \quad c = a + b + d \quad or \quad d = a + b + c \]Please note that even if two triangles have the same angle, they are treated as distinct if they come from different indices.
inputFormat
The first line contains an integer n (4 ≤ n ≤ 50), representing the number of triangles.
The second line contains n space-separated integers, each representing the vertex angle (in degrees) of a triangle.
outputFormat
Output a single integer representing the count of valid sets of four distinct triangles that can form a big triangle.
sample
4
1 2 3 6
1