IntermediateRating 1400
Fewest Square Numbers
Print the fewest perfect squares (1, 4, 9, …) that add up to n.
Input
One integer n (1 ≤ n ≤ 10⁴).
Output
One integer.
Sample 1
Input
12
Output
3
Sample 2
Input
13
Output
2
Output appears hereOne integer n (1 ≤ n ≤ 10⁴).
One integer.
12
3
13
2
Output appears here