Question
Counting Island Groups

An archipelago has N islands, numbered from 1 to N. There are M two-way bridges, each connecting a pair of islands.

Two islands belong to the same group if you can walk from one to the other using one or more bridges. An island with no bridges forms a group by itself.

The tourism board wants to know how many separate island groups exist.

Input

The first line contains two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression — the number of islands and the number of bridges.

Each of the next KaTeX can only parse string typed expression lines contains two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression, meaning there is a two-way bridge between islands KaTeX can only parse string typed expression and KaTeX can only parse string typed expression.

Output

Print a single integer — the number of island groups (connected components).

Example
Example 1:
Input
6 4

1 2
2 3
4 5
5 6
Output
2
Explanation
Islands KaTeX can only parse string typed expression form one group and islands KaTeX can only parse string typed expression form another. There are KaTeX can only parse string typed expression groups.

Example 2:
Input
4 0
Output
4
Explanation
With no bridges, each island stands alone, giving KaTeX can only parse string typed expression groups.

Example 3:
Input
5 4

1 2
2 3
3 4
4 5
Output
1
Explanation
All five islands are linked into a single chain, so they form one group.

Online