Count how many staircases of a given total size can be built using step sizes that divide the total evenly.
Petya wants to build a staircase with a total of cubes. A staircase is formed by several steps, where each step has a positive integer height, and the step heights are strictly increasing from left to right.
A valid staircase must use exactly cubes in total. Among all possible staircases, Petya is interested in those where the greatest common divisor of all step heights is greater than 1, so that every step height is divisible by the same integer larger than 1.
Your task is to determine the largest possible number of steps in such a staircase. If no such staircase exists, output 0.
Example 1
Input
6
Output
2
Explanation
One valid staircase is heights 2 and 4, which are strictly increasing and sum to 6. No staircase with more than 2 steps satisfies the condition.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.