B - Constellations

 

Problem

The Astronomers of the ZiggyZig Planet have an obsession: they constantly observe the sky to find out new star constellations. Star constellations are based on the starlines of the Force. For centuries, they have engraved the drawings of the constellations in the dome of their most sacred shrine and use them to predict the future. Astronomers register the starlines of the Force between stars whenever they are detected by an ancient device called the Forssometer.

A hard problem that astronomers have always faced is that starlines of the Force sometimes change from time to time, and this makes it difficult to keep the constellation map always up to date. Anyway, they always have manage to make the job perfectly, in particular, the number of different constellations observed at each time must be known at all times.

 

There is an ancient law that says that whenever a starline of the Force exists between two stars then these two  starts belong to the same constellation.

Your job is to write a program that computes the number of different constellations for the ”Daily Constellation Report” which is issued every morning based on last night’s readings.

 

Input

The input of your program is a sequence of input text lines. The first input line contains a positive integer N indicating the number of starlines to process. After that the input contains N input line, each describing a starline. Each starline is specified by four integers x1 y1 x2 y2 indicating the endpoints (x1,y1) and (x2,y2) of the starline. The coordinate system ranges from 0 to 9999 (including the 0 and 9999).

 

Output

The output of your program consists of a single line containing the number of constellations detected in the input.

 

Sample Input

10

0 0 0 10

0 10 10 10

10 10 10 0

10 0 0 0

1 1 2 1

2 1 2 2

2 2 1 2

1 2 1 1

1 1 2 2

2 2 3 3

 

Sample Output

2