Polygon Diagonal Intersections

Interview

Time limit1sMemory limit128 MB

Summary
Given N, a convex N-gon with no three diagonals concurrent, compute the number of interior diagonal intersection points using the combinatorial formula C(N,4).
Level

Easy3 of 10

Topics
Combinatorics, Math
Solved
No attempts yet

Problem

You are given a convex N-gon. No three diagonals meet at the same point. Count the number of points inside the polygon where two diagonals intersect.

A polygon is convex if every interior angle is less than 180 degrees.

Input

The first line contains an integer N. (3 ≤ N ≤ 100)

Output

Print the number of diagonal intersection points.

Examples3

  1. Example 1

    Input
    3
    
    Expected output
    0
    
  2. Example 2

    Input
    4
    
    Expected output
    1
    
  3. Example 3

    Input
    6
    
    Expected output
    15