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

#SP0000205. Số thừa số nhiều nhất của giai thừa (Factorial Factors)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Số thừa số nhiều nhất của giai thừa (Factorial Factors)

Factorial Factors

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Given an integer n≥2n\ge2, express n!n! as a product of integers greater than 11. Repeated factors are allowed.

Find the maximum possible number of factors in such a product. For example, 8!=27⋅32⋅5⋅78!=2^7\cdot3^2\cdot5\cdot7 can be expressed using 7+2+1+1=117+2+1+1=11 prime factors, and no factorization into integers greater than 11 has more than 1111 factors.

Input

The only line contains nn.

Output

Print the maximum number of integer factors greater than 11 whose product is n!n!.

Subtasks

  • Subtask 1 (20 points): 2≤n≤1002\le n\le 100.
  • Subtask 2 (30 points): 2≤n≤1042\le n\le 10^4.
  • Subtask 3 (50 points): 2≤n≤1062\le n\le 10^6.

Examples

Input

8

Output

11

Explanation

Factorizing 8!8! gives 27⋅32⋅5⋅72^7\cdot3^2\cdot5\cdot7. Splitting every prime power into prime factors gives 7+2+1+1=117+2+1+1=11 factors. Combining primes into composite factors can only reduce their count, so 1111 is optimal.