luogu#P6153. 询问
询问
Background
zbw was invited to a kindergarten to create problems for children.
Problem Description
Now zbw has items, numbered from . He will tell you conditions. Each condition contains two numbers , meaning that item and item are the same.
Because zbw is in a big hurry, he guarantees that every condition he gives is useful; that is, each condition cannot be deduced from the previous conditions.
You need to answer how many different kinds of items there are.
Input Format
The first line contains two integers and .
Then follow lines. Each line contains two numbers , meaning that item and item are the same.
Output Format
Output one integer: the number of different items.
11 8
1 2
4 3
5 4
1 3
5 6
7 10
5 10
8 9
3
Hint
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, , .
Translated by ChatGPT 5