ADABASH - Ada and Servers


Ada the Ladybug has just bought a few servers. She is not a programming bug so she needs a server administrator to set everything for her. Yay, she have chosen you to help her. Your first job is simple - the servers are (somehow) connected with wires and you have to find out the number of components they form.

Easy isn't it? Well sadly the servers are raw and nothing is (can be) installed on them (at the moment), so you can only use bash.

Input

The first line of input contains 1 ≤ N ≤ 600, 0 ≤ M ≤ 600, the number of servers and the number of wires between them. The next M lines contains two integers 0 ≤ a, b < N, the servers which are connected by wires.

Output

Print the number of connected components.

Example Input

6 3
1 2
3 4
5 0

Example Output

3

Example Input 2

11 9
0 10
1 6
1 8
2 7
2 8
3 4
3 6
4 7
4 10

Example Output 2

3

Example Input 3

5 2
0 4
1 4

Example Output 3

3

Example Input 4

5 1
1 2

Example Output 4

4

Example Input 5

4 2
1 3
0 2

Example Output 5

2

hide comments
denver23: 2024-07-09 04:12:59

You can submit only in bash :D

jpfr12: 2021-09-02 03:15:07

these questions where you can't submit with C++, Java, or Python are useless for practice for contests.

scolar_fuad: 2019-07-08 11:22:05

f*ck there is no bash solver

Last edit: 2022-06-26 20:14:21

Added by:Morass
Date:2017-09-01
Time limit:4s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:BASH