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

#GL0000177. Đếm cơ số làm xuất hiện chữ số 0 tận cùng (Trailing Zeroes (I))

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Đếm cơ số làm xuất hiện chữ số 0 tận cùng (Trailing Zeroes (I))

Trailing Zeroes (I)

Source: LightOJ

Version: Phuoc Hung OJ Extended

Problem Statement

A positive integer NN can be written in different bases. For instance, 9=1003=1099=100_3=10_9, so both base 33 and base 99 yield a representation that ends in zero.

You may choose any integer base b≥2b\ge2. A base is valid when the last digit of NN in that base is 00; only one trailing zero is required.

Count all valid bases. Even though there is no upper bound on the base, the answer is finite.

Input

One line containing a positive integer NN.

Output

Print the number of integer bases b≥2b\ge2 for which NN ends in digit 00.

Subtasks

  • Subtask 1 (20 points): 1≤N≤1061 \le N \le 10^6.
  • Subtask 2 (30 points): 1≤N≤1091 \le N \le 10^9.
  • Subtask 3 (50 points): 1≤N≤10121 \le N \le 10^{12}.

Examples

Example 1

Input

9

Output

2

Explanation

The valid bases are 33 and 99: 9=1003=1099=100_3=10_9. No other integer base is valid.

Example 2

Input

1

Output

0

Explanation

The integer 11 has last digit 11 in every base b≥2b\ge2, so the answer is 00.