In the event of technical difficulties with Szkopuł, please contact us via email at firstname.lastname@example.org.
If you are familiar with IRC chat, the support team is also reachable on PIRC network (
#szkopul channel. If you are not, just use email.
Please do not ask us things like "how to solve task XYZ?".
Please remember that the support team has to sleep sometimes or go to work in real life.
Byteotian Intelligence Agency (BIA) employs many spies. Each of them has duty to shadow exactly one other spy.
King Byteasar wants to entrust as many agents as possible with a top secret operation. However, the operation is so important that each spy taking part has to be traced by at least one agent not involved in the operation (assignment of shadowing BIA spies does not change).
Write a programme that:
In the first line of the input there is one positive integer written, - the number of spies, . The spies are numbered from to . In the following lines there is a description of whom each agent spies. Each of these lines contains one positive integer. A number situated in line no. indicates, that the spy no. shadows the spy no. , , , .
Your programme should write one integer in the first line of the output - the maximal number of spies that can be assigned to the secret operation.
For the input data:
6 2 3 l 3 6 5
the correct result is:
Task author: Pawel Parys.