This page is still under construction.

Parts of this page are still being built. What you see may change.

Triangles from Five Sticks

Interview

Time limit2sMemory limit512 MB

Summary
Given five distinct stick lengths, count how many 3-stick subsets can form a triangle with positive area.
Level

Easy2 of 10

Topics
Brute force, Geometry, Implementation
Solved
No attempts yet

Problem

Vera has five sticks, and no two of them have the same length. The lengths are l1,l2,l3,l4,l5l_1, l_2, l_3, l_4, l_5. Vera may pick any three of them and use the three sticks as the sides of a triangle. The sticks cannot be bent or cut, and the triangle must have positive area.

How many different triangles can Vera make?

Input

The first line contains the integers l1,l2,l3,l4,l5l_1, l_2, l_3, l_4, l_5 separated by spaces. (1≤li≤10001 \le l_i \le 1000)

Output

Print the number of ways to form a triangle as a single integer on one line.

Hint

In the first example the three triangles come from the lengths 2, 3, 4 and 2, 4, 5 and 3, 4, 5.

Examples3

  1. Example 1

    Input
    1 2 3 4 5
    
    Expected output
    3
    
  2. Example 2

    Input
    1 2 4 8 16
    
    Expected output
    0
    
  3. Example 3

    Input
    100 101 102 103 104
    
    Expected output
    10