Mail of the sponsor
You remember the problem "The word of sponsor" from New Year contest. I remind you briefly that problem: after the event finished, the sponsor wanted to send out the prizes for winners.
But the postal system is not perfect and not all the prizes can be delivered to participants. There are post offices in the country, numbered from to . The sponsor sends the prizes from the office number . Also, we know the mail transportation system — the pairs of post offices between which the mail can be passed.
Before the new competition the sponsor decided to guarantee the safe delivery of prizes. To do this, the sponsor is ready to establish new links between some pairs of post offices. Your task is to find the least amount of new connections, so that prizes can be delivered after the competition to all participants, regardless of where they live and which post office use.
Input
First line contains three integers — the number of post offices , the number of post office the sponsor uses and the number of links between the pairs of offices .
Each of the next lines contains two numbers: and — the numbers of post offices, between which the mail transportation exists and are different numbers from interval . All the pairs are different.
Output
Print one number — the minimum possible number of new connections to be created, so that the mail can be delivered from to any other post office.