eolymp
bolt
Try our new interface for solving problems
Problems

Chords

Chords

Time limit 1 second
Memory limit 122 MiB

One draws n chords in a circle and cut in along the received lines. How many parts shall we get from the circle?

It is known that the chord's endpoints are different, no 3 chords intersects at one point.

Input data

The first line contains the number of chords n (1n30 000). Each of the next n lines contains two numbers a[i] and b[i] (0 ≤ a[i], b[i] < 360) with accuracy of three digits after the decimal point - the polar angles of the initial and final points the next chord. The start of the polar coordinate system is located in the center of the circle.

Output data

Print the number of parts into which the circle is cut.

Examples

Input example #1
2
0 180
90 270
Output example #1
4
Author Igor Andrianov