In the event of technical difficulties with Szkopuł, please contact us via email at email@example.com.
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.
A tournament is a directed graph in which:
Let's take the set of vertices and the permutation : , , , . There are only four tournaments for which this permutation is an automorphism:
Write a program which:
In the first line of the standard input there is one integer , , which is the number of vertices. In the following lines there is a description of a permutation . We assume that vertices are numbered from 1 to . In line there is a value of the permutation for the vertex (i.e. the value ).
In the first and only line of the standard output there should be one integer equal to the remainder of dividing (the number of different -vertex tournaments for which is an automorphism) by .
For the input data:
4 2 4 3 1
the correct result is:
Task author: Grzegorz Jakacki.