Limits 1s, 512 MB

Itsy went for a walk and found several sticks in the park. She is wondering how many of these sticks can she use to make right angled triangles.

The sticks are all straight and of integer lengths. Yes, amazing things happen in the world of problem solving if you want to believe it.

You will be given the lengths of the sticks.

You will have to determine the number of sticks from which you can take three sticks at a time to make a right angled triangle.

A right angled triangle has one angle that is 90°90\degree.

You can reuse the same stick in different triangles, but you will count the stick only once in your result.


The first line contains an integer NN (3N1003 \le N \le 100). NN is the number of sticks Itsy has collected.

The following line contains NN integers. Each of these integers, LiL_i (1Li1001 \le L_i \le 100), represents the length of a stick that Itsy has collected.


Print the number of sticks Itsy can use to make right-angled triangles.


2 3 4 3 5


Login to submit.


72% Solution Ratio
ToooonmoyEarliest, Dec '22
YouKnowMEEMFastest, 0.0s
habijabiLightest, 4.9 MB
Nusab19Shortest, 266B
Toph uses cookies. By continuing you agree to our Cookie Policy.