Wenchuan has had an earthquake that has struck a town.The earthquake has damaged some of the villages so that they are unpassable. Remarkably, none of paths was damaged.
As usual, the town is modeled as a set of P (1 <= P <= 3,000) villages conveniently numbered 1…P which are connected by a set of C (1 <= C <= 20,000) non-directional paths conveniently numbered 1...C. path i connects village Ai and Bi. paths might connect Ai to itself or perhaps might connect two villages more than once. The town government is located in village 1.
A total of N (1 <= N <= P) villages sequentially contacts the town government via moobile phone with an integer message Vj (2 <= Vj <= P) that indicates that village Vj is undamaged , but the villagers is unable to return to the town government from village Vj , because they could not find a path that does not go through damaged villages.
After all the villages report in, determine the minimum number of villages that are damaged.