Count Connected Components


Submit solution

Points: 100
Time limit: 2.0s
Memory limit: 256M

Author:
Problem types

Count the connected components of an undirected graph, including isolated vertices.

Input

The first line contains n and m. The next m lines contain undirected edges.

  • 1 <= n <= 1000
  • 0 <= m <= n(n-1)/2

Output

Print the number of connected components.

Example

Input
6 3
1 2
2 3
5 6
Output
3

Comments

There are no comments at the moment.