def main(): N = int(input()) n = N num = 0 while 1: i = coin(n) n -= i num += 1 if not n: break print(num) def coin(n): i = 1 while 1: k = i * (i + 1) // 2 if k > n: break else: x = k i += 1 return x main()