PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000036. Số lượng ước tối đa (Maximum Factors)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Số lượng ước tối đa (Maximum Factors)

Maximum Factors

Source: CodeChef

Version: Phuoc Hung OJ Extended

Problem Statement

You are given a positive integer NN. Choose a positive divisor KK of NN such that K>1K>1, and define

M=NK.M=\frac{N}{K}.

A positive divisor of MM is a positive integer dd for which MM is divisible by dd.

Among all valid choices of KK, maximize the number of positive divisors of MM. If several values of KK attain the same maximum, choose the smallest one.

For the special case N=1N=1, this version defines the answer as 11, following the behavior of the source's reference implementation.

Input

One line containing a positive integer NN.

Output

Print one integer: the smallest optimal KK, or 11 if N=1N=1.

Subtasks

  • Subtask 1 (20 points): 1≤N≤1031\le N\le10^3.
  • Subtask 2 (30 points): 1≤N≤1061\le N\le10^6.
  • Subtask 3 (50 points): 1≤N≤1091\le N\le10^9.

Examples

Input

18

Output

3

Explanation

The divisors K>1K>1 of 1818 are 2,3,6,9,182,3,6,9,18.

  • For K=2K=2, M=9M=9 has 33 positive divisors: 1,3,91,3,9.
  • For K=3K=3, M=6M=6 has 44 positive divisors: 1,2,3,61,2,3,6.
  • For K=6K=6, M=3M=3 has 22 positive divisors.
  • For K=9K=9, M=2M=2 has 22 positive divisors.
  • For K=18K=18, M=1M=1 has 11 positive divisor.

The maximum divisor count is 44, attained for K=3K=3, so the output is 3.

Input

72

Output

2

Explanation

We have 72=23⋅3272=2^3\cdot3^2. Choosing K=2K=2 gives M=36M=36, whose nine positive divisors are 1,2,3,4,6,9,12,18,361,2,3,4,6,9,12,18,36. Choosing K=3K=3 gives M=24M=24, which has only eight positive divisors. No other KK yields more than nine, hence the answer is 2.

Input

1

Output

1

Explanation

There is no divisor K>1K>1 when N=1N=1. By the explicitly stated special convention, print 1.