minimum-roads
Source: hackerearth
Difficulty: EASY

There is a group of cities known as states. Each state contains a lot of cities but some states are disjoint. Find out minimum number of roads required such that if we pick any two pair of cities then path should be there between the two.
Remember that all roads in input may not cover all cities because if there is only one city in a state then there is no possibility of intercity roads

Input
First line contains N,E as input. Next E lines contain two space separated numbers u and v stating there is an edge between u and v 

Constraints
1 ≤ N ≤ 10^5
1 ≤ E ≤ 2 x 10^5

SAMPLE INPUT
4 2
1 2
3 4

SAMPLE OUTPUT
1

Explanation

As per the given input for four cities we can guess that there are 2 states and if we add only one road to the map then we can see that every two pair of cities can be reached from one another.