An archipelago has
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.
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.
Print a single integer — the number of island groups (connected components).
Input
6 4
1 2
2 3
4 5
5 6Output2ExplanationIslands 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 0Output4ExplanationWith 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 5Output1ExplanationAll five islands are linked into a single chain, so they form one group.