Time limit
1s
Memory limit
128 MB
A worm virus spreads along network connections. If one computer is infected, every computer in the same connected component can become infected.
Computer 1 is infected. Given the number of computers and the pairs of computers directly connected by the network, determine how many other computers become infected through computer 1.
Do not count computer 1 itself.
The first line contains the number of computers N. N is a positive integer no greater than 100, and the computers are numbered from 1 to N.
The second line contains the number M of pairs of computers that are directly connected in the network. Each of the next M lines contains two computer numbers a and b that are directly connected.
Print one integer: the number of computers other than computer 1 that become infected through computer 1.