You are given an integer N, which is greater than 1.
Consider the following functions:
- f(a)=aNmodN
- F_1(a)=f(a)
- F\_{k+1}(a) = F\_k(f(a))\~\~(k = 1,2,3,\ldots)
Note that we use mod to represent the integer modulo operation. For a non-negative integer x and a positive integer y, xmody is the remainder of x divided by y.
Output the minimum positive integer k such that F_k(a)=a for all positive integers a less than N. If no such k exists, output −1.