#K35017. Camera Installation in Houses

    ID: 25438 Type: Default 1000ms 256MiB

Camera Installation in Houses

Camera Installation in Houses

You are given a town with n houses numbered from 1 to n and m bidirectional roads connecting some pairs of houses. Your task is to determine the minimum number of houses at which cameras should be installed so that every road is monitored. In other words, for every road connecting two houses, at least one of those houses must have a camera.

Recent studies suggest that placing cameras at only the vulnerable junctions (articulation points) of the town’s road network would be enough to monitor every connection. A house is called an articulation point if its removal increases the number of connected components of the graph. Use this concept to determine the minimum number of houses to equip with cameras.

Note: If there are no roads, then no camera is needed.

The input guarantees that the houses are labeled 1 to n. The road network might be disconnected.

inputFormat

The input is given via standard input in the following format:

n m
u1 v1
u2 v2
... 
um vm

Here, the first line contains two integers n (the number of houses) and m (the number of roads). Each of the next m lines contains two integers ui and vi representing a road between house ui and house vi.

outputFormat

Output via standard output a single integer: the minimum number of houses that require a camera installation so that every road is monitored.

## sample
5 5
1 2
1 3
3 4
3 5
4 5
2