Under construction

Still being built. Things may change

Products

Time limit1sMemory limit128 MB

Summary
Find the minimum count k of positive integers a1..ak such that the product of (ai+1) equals n times the product of ai.
Level

Hard8 of 10

Topics
Number theory, Math, Backtracking, Brute force
Solved
No attempts yet

Problem

Let nn be a positive integer. George wrote a program that finds positive integers a1,a2,…,aka_1, a_2, \ldots, a_k whose product increases exactly nn times when we add 1 to each of them; that is,

(a1+1)(a2+1)⋯(ak+1)=n⋅a1a2⋯ak(a_1+1)(a_2+1)\cdots(a_k+1) = n \cdot a_1 a_2 \cdots a_k

Now he wants to find the smallest value of kk for which this is possible. Write a program mink that solves George's new task.

Input

The first line of standard input contains the integer nn (2<n<10002 < n < 1000).

Output

Write the required value of kk on a single line of standard output.

Examples1

  1. Example 1

    Input
    4
    
    Expected output
    2