Question: Input Format The first line of input contains a single integer n (1n55) the number of pathways. Each of the following n lines contains two

Input Format

The first line of input contains a single integer n (1n55) the number of pathways. Each of the following n lines contains two integers xi and yi (1xi,yi1000) the coordinates of the i-th pathway. Note that the north direction coinides with the direction of y axis, so the east direction coinides with the direction of the x axis. All pathways locations are distinct.

Constraints

n (1n55) (1xi,yi1000)

Output Format

Output the minimal number of pathways that need to be created in order for Zahir to be able to reach any pathway from any other one.

Sample Input 0

2 2 1 1 2

Sample Output 0

1

Any Language: Java , Python, C, Javascript

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!