Hide

# Straza

Near a military base there is a system of trenches, modeled as line segments on a plane. During nighttime, when most soldiers are fast asleep, three guards stand watch of the trenches. Two guards can see each other if there is a trench (or a row of trenches) along the entire straight line segment between them and there is no third guard on that line segment.

For security reasons, the guards must be placed so that each guard sees the other two. How many ways can they be placed?

## Input

The first line contains the integer $N$ $(1 \leq N \leq 20)$, the number of trenches. Each of the next $N$ lines contains the description of one trench: four non-negative integers $X_1, Y_1, X_2, Y_2$ (all less than or equal to $1\, 000$), where $X_1$ and $Y_1$ are coordinates of one end, while $X_2$ and $Y_2$ are coordinates of the other end of the trench.

Trenches in the input may overlap and share endpoints.

## Output

Output the number of ways the guards can be placed on a single line.

Sample Input 1 Sample Output 1
6
0 0 1 0
0 0 0 1
1 0 1 1
0 1 1 1
0 0 1 1
1 0 0 1

8

Sample Input 2 Sample Output 2
4
5 1 7 1
1 1 5 1
4 0 4 4
7 0 3 4

1

Sample Input 3 Sample Output 3
3
2 2 3 2
3 2 3 3
3 3 2 3

0

CPU Time limit 1 second
Memory limit 1024 MB
Difficulty 7.0hard
Statistics Show