Jaś loves building triangles out of sticks. He keeps the sticks in a bag and draws three of them at random. Because the sticks have different lengths, three drawn sticks cannot always form a triangle, and when they cannot, Jaś throws a tantrum. To prevent this, we want to throw away some of the sticks so that any three of the sticks left in the bag can form a triangle, while keeping as many sticks as possible.
Three sticks of lengths a, b, c form a triangle when the sum of every two of them is greater than the third; equivalently, if a≤b≤c, they form a triangle exactly when a+b>c (a flat, degenerate triangle does not count).
Write a program that:
The first line contains an integer N (5≤N≤30000), the number of sticks in the bag. Each of the next N lines contains one integer, the length of a stick. Every length is an integer between 1 and 500 inclusive.
Print one line: the maximum number of sticks that can remain in the bag so that any three of them form a triangle.