CCOMPS - Count Components
Given an undirected graph of N nodes (numbered from 1 to N) and M edges, find the number of its connected components.
The first line of input consists of two integers, N and M, the number of nodes and the number of edges respectively. (N ≤ 100000, M ≤ 200000)
The next M lines of input contain a pair of integers (x, y) representing anedge between nodes x and y. (1 ≤ x, y ≤ N)
To the first and only line of output, print a single integer: the number of connected components.
Input: 5 2 1 2 3 4