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

#SP0000160. Lũy thừa bậc p lớn nhất (Perfect P-th Powers)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Lũy thừa bậc p lớn nhất (Perfect P-th Powers)

Perfect P-th Powers

Source: UVa 10622 — https://onlinejudge.org/external/106/10622.pdf
Edition: Phuoc Hung OJ Extended; one dataset per program run. Subtasks are authored for PHOJ, not claimed to be official.

Problem

Given an integer xx with ∣x∣≥2|x|\ge 2, find the largest positive integer pp for which x=bpx=b^p for an integer bb. For negative xx, pp must be odd.

Input

One integer xx.

Output

Output the greatest pp.

Subtasks

  • Subtask 1 (20 points): 2≤∣x∣≤1032\le |x|\le 10^3.
  • Subtask 2 (30 points): 2≤∣x∣≤1062\le |x|\le 10^6.
  • Subtask 3 (50 points): −231≤x≤231−1-2^{31}\le x\le 2^{31}-1, ∣x∣≥2|x|\ge2.

Example

Input

1073741824

Output

30

Explanation

1073741824=2301073741824=2^{30}, hence the largest exponent is 3030.