Find the order of a permutation .
A permutation of elements is an ordered sequence of distinct integers from to .
The order of a permutation is the smallest positive integer such that p^k = \varepsilon, where is the identity permutation (1, 2, \ldots, n).
The first line contains a positive integer (0 < n \leq 100), the size of the permutation . The second line contains the permutation , represented as a sequence of integers.
Print the order of the given permutation.
Example 1
Example 2