1247  LL's lock
Time Limit : 1 Second
Memory Limit : 128 MB
Submission: 91
Solved: 52
 Description
 LL got a box unexpectedly, but the box is protected by a password lock. Besides the lock, there are N sticks with various lengths. LL guessed that the password is the number of different triangles composed by three of these N sticks. Please find this password for him.
Note: two triangles are considered different if they are not composed of the same sticks, even if they have the same size and shape.  Input
 There are multiple cases ended with EOF. Every case have two lines .
The first number of each case is one number——N (3 <= N <= 1000).
The following N positive integers li (1 <= li <= 1000000000) are the lengths of N sticks.  Output
 For each case, output one line containing a single integer—the password deduced.
 sample input

3 1 2 4 8 13 15 4 2 6 9 20 13
 sample output

0 21
 hint
 source