This page is still under construction.

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

Triangles

Time limit1.2sMemory limit1024 MB

Summary
Count triangles formed by n points, no three collinear, that contain at least one other point strictly inside.
Level

Medium6 of 10

Topics
Geometry, Combinatorics, Sorting, Math
Solved
No attempts yet

Problem

A triangle is a simple polygon having exactly three distinct corners that are not collinear. For any set SS of points in the plane, a triangle is said to have a conflict with SS if there is at least one point contained both in SS and in the interior of the triangle, excluding its boundary, simultaneously.

Now, the set SS is given to be a set of nn points in the plane, no three of which are collinear, and let TT be the set of all triangles whose corners are chosen from the set SS. How many of those in TT have a conflict with SS?

Write a program that outputs the number of triangles in TT that have a conflict with SS.

Input

Your program is to read from standard input. The input starts with a line containing an integer nn (3≤n≤5003 \le n \le 500), where nn is the number of points in the set SS. Each of the following nn lines consists of two integers, each between −106-10^6 and 10610^6, representing the coordinates of each point in the set SS. It is guaranteed that no three points in the set SS are collinear.

Output

Your program is to write to standard output. Print exactly one line. The line should contain an integer that represents the number of triangles whose corners are chosen from the set SS and that have a conflict with the set SS.

Examples2

  1. Example 1

    Input
    4
    1 1
    0 0
    2 3
    6 1
    
    Expected output
    1
    
  2. Example 2

    Input
    6
    0 1
    2 0
    3 -2
    3 2
    7 1
    2 4
    
    Expected output
    6