## Max's Anger Contest Series 2 P5 - Job Anger

View as PDF

Points: 12 (partial)
Time limit: 2.0s
Java 5.0s
Python 5.0s
Memory limit: 1G

Author:
Problem types

After landing his first SWE job, Max is assigned to analyze the data lines on a chiplet.

Specifically, the chiplet has data lines that are either vertical or horizontal from to .

It is known that if two data lines intersect, the data travels slower across both lines.

To determine the inefficiency of a chiplet, Max is told to count the number of intersections between vertical and horizontal data lines.

Two data lines intersect if they are in different directions (one is vertical and one is horizontal) and share one point along both lines.

Further, the start point and end point for a data line are never identical.

Since Max is being sabotaged by Wesley new, all of his code produces Runtime Errors, so he asks you to help him as a co-worker.

Can you help Max count the number of intersections of vertical and horizontal data lines?

#### Constraints

or

Note that both will NOT be true (i.e. a data line cannot be diagonal).

#### Input Specification

The first line contains an integer, , the number of data lines.

The next lines contain four integers, , , , , the start point and end point of the data line.

#### Output Specification

Output the number of intersections between vertical and horizontal data lines.

#### Sample Input

6
0 0 5 0
2 0 9 0
2 0 2 3
2 1 2 5
0 4 3 4
-50 -50 -50 -49

#### Sample Output

3

#### Explanation for Sample

The first and second data lines intersect with the third data line, and the fourth one intersects with the fifth data line.

Note that, despite the first and second data line overlapping, they do not intersect since they are both horizontal.

Likewise, the third and fourth data line overlap but do not intersect since they are both vertical.