STRAZA - STRAZA

Near a military base there is a system of trenches, modeled as line segments on a plane. During night time, 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 ≤ N ≤ 20), the number of trenches. Each of the next N lines contains the description of one trench: four positive integers X1, Y1, X2, Y2 (all less than or equal to 1000), where X1 and Y1 are coordinates of one end, while X2 and Y2 are coordinates of the other end of the trench.

Trenches in the input may overlap and share endpoints.

Output

In a single line, output the number of ways the guards can be placed.

Example

Input:
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

Output:
8
Input:
4
5 1 7 1
1 1 5 1
4 0 4 4
7 0 3 4

Output:
1
Input:
3
2 2 3 2
3 2 3 3
3 3 2 3

Output:
0

Added by:Santiago Zubieta
Date:2011-11-30
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Croatian Open Competition in Informatics (COCI), Contest 2 - November 25, 2006

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.