Hide

Problem J
Sum of the Year

/problems/sumoftheyear/file/statement/en/img-0001.png
Proof without words of Nicomachus’s theorem CC BY-SA 3.0 by Cmglee on Wikimedia

The year $2025$ has the curious property that

\[ 2025 = (1 + 2 + \dots + 9)^2 = 1^3 + 2^3 + \dots + 9^3. \]

Ivan found this to be an intriguing coincidence and wonders how many other such coincidences there are. Can you help him?

Input

The input consists of a single positive integer $n$ ($1 \leq n \leq 1\, 000$).

Output

Output the number of $k$, with $1 \leq k \leq n$, such that

\[ (1 + \dots + k)^2 = 1^3 + \dots + k^3. \]
Sample Input 1 Sample Output 1
1
1
Sample Input 2 Sample Output 2
3
3

Please log in to submit a solution to this problem

Log in