#P2181. Intersection Points of Diagonals in a Convex Polygon

    ID: 15462 Type: Default 1000ms 256MiB

Intersection Points of Diagonals in a Convex Polygon

Intersection Points of Diagonals in a Convex Polygon

Given a convex polygon with n vertices, no three diagonals are concurrent. Your task is to calculate the number of intersection points formed by the diagonals inside the polygon.

It is known that each intersection point is uniquely determined by choosing 4 vertices among n vertices (since any 4 vertices determine a quadrilateral whose two diagonals intersect). Thus, the answer is given by the formula: \( \binom{n}{4} \).

For example, for a hexagon (n = 6), the number of intersection points is \( \binom{6}{4} = 15 \).

inputFormat

The input consists of a single integer n (n \ge 0). When n is less than 4, there are no intersection points.

Input format:

n

outputFormat

Output a single integer representing the number of intersection points of the diagonals in the given convex polygon.

Output format:

result

sample

4
1