You are given a permutation containing each integer from to exactly once.
For a positive integer , let be the sequence of length obtained by concatenating copies of . For example, if , then .
Find the minimum such that the longest strictly increasing subsequence of has length .
Strictly increasing subsequences
A subsequence is obtained by deleting zero or more elements while preserving the order of the remaining elements. The chosen elements need not be consecutive.
A subsequence is strictly increasing if every element after the first is greater than the preceding element. A subsequence of length is also strictly increasing.
The input is given in the following format:
Print the minimum for which the longest strictly increasing subsequence of has length .
The first line contains the permutation length . The second line contains , separated by spaces.
| 3 | 26 | . |
| 4 | 44 | No additional constraints. |