# Connected Components

Time limit: 0.5s Memory limit: 64MB Input: Output:

You are given an undirected graph $G$ with $N$ vertices and $M$ edges. Find how many connected components the given graph has.

A connected component is a maximal subset of vertices from the graph such that for every two nodes $A$ and $B$ in the connected component, we can reach $A$ from $B$ using one or more edges.

## Input data

The first line will contain two numbers, $N$ and $M$, representing the number of vertices and edges the graph has. The next $M$ lines will contain the description of the graph, with one edge on each line.

## Output data

The first line will contain a single number, representing the number of connected components the graph has.

## Constraints and clarifications

• $1 \leq N \leq 100 \ 000$
• $1 \leq M \leq 200 \ 000$
• $1 \leq A, B \leq N$, $A \neq B$
• There are no two identical edges.
• For tests worth $40$ points, $N \leq 1 \ 000$.

## Example 1

stdin

6 3
1 2
1 4
3 5


stdout

3


### Explanation

Vertexes $1$, $2$ and $4$ are in the same connected component.
Vertexes $3$ and $5$ are in the same connected component.
Vertex $6$ is also in its own connected component.

Therefore, we have $3$ connected components.

## Example 2

stdin

4 2
1 2
3 4


stdout

2