As we all know, the number of 's papers follows exponential growth. Therefore, we are curious about sequence.
You are given a prime . A sequence is a sequence if and only if there is an integer such that for all integers , .
Given a sequence , what is the length of the longest subsequence of ?
A subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.
is super busy recently, so the only thing he wants to know is whether the answer is greater than or equal to .
If the length of the longest sequence is less than , output . Otherwise, output the length of the longest subsequence.